Skip to content

Instantly share code, notes, and snippets.

@mgrouchy
Created March 15, 2011 02:04
Show Gist options
  • Save mgrouchy/870197 to your computer and use it in GitHub Desktop.
Save mgrouchy/870197 to your computer and use it in GitHub Desktop.
from django.auth.models import User
from django.shortcuts import get_object_or_404
#this view would be publicly accessable
def hook(request, username=None):
user = get_object_or_404(User, username=username) #cant remember the syntax
if not isinstance(User, user):
return user #this returns a 404
#now we know what user we are dealing with
#so we do something with the data github just posted to us
data = request.POST.get('payload')
data = json.dumps(data) #or simplejson if necessecary
#do something with the data
return HttpResponse("OK")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment