skeleton for /api/travisci/webhook

pull/1/head
Raymond Yee 2016-02-18 11:37:35 -08:00
parent 4792d03920
commit fb9a2bcd04
2 changed files with 8 additions and 0 deletions

View File

@ -27,5 +27,6 @@ urlpatterns = patterns('',
url(r"^onix/$", OnixView.as_view(), name="onix_all"), url(r"^onix/$", OnixView.as_view(), name="onix_all"),
url(r'^id/work/(?P<work_id>\w+)/$', 'regluit.api.views.negotiate_content', name="work_identifier"), url(r'^id/work/(?P<work_id>\w+)/$', 'regluit.api.views.negotiate_content', name="work_identifier"),
url(r'^loader/yaml$','regluit.api.views.load_yaml', name="load_yaml"), url(r'^loader/yaml$','regluit.api.views.load_yaml', name="load_yaml"),
url(r'^travisci/webhook$','regluit.api.views.travisci_webhook', name="travisci_webhook"),
(r'^', include(v1_api.urls)), (r'^', include(v1_api.urls)),
) )

View File

@ -6,6 +6,7 @@ from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response, get_object_or_404 from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext from django.template import RequestContext
from django.views.decorators.csrf import csrf_exempt
from django.views.generic.base import View, TemplateView from django.views.generic.base import View, TemplateView
from django.http import ( from django.http import (
HttpResponse, HttpResponse,
@ -14,6 +15,8 @@ from django.http import (
Http404, Http404,
) )
import regluit.core.isbn import regluit.core.isbn
from regluit.core.bookloader import load_from_yaml from regluit.core.bookloader import load_from_yaml
from regluit.api import opds, onix from regluit.api import opds, onix
@ -76,6 +79,10 @@ def load_yaml(request):
return HttpResponseRedirect(reverse('work', args=[work_id])) return HttpResponseRedirect(reverse('work', args=[work_id]))
except: except:
return HttpResponse('unsuccessful') return HttpResponse('unsuccessful')
@csrf_exempt
def travisci_webhook(request):
return HttpResponse('travisci webhook')
class ApiHelpView(TemplateView): class ApiHelpView(TemplateView):
template_name = "api_help.html" template_name = "api_help.html"