Skip to content

Instantly share code, notes, and snippets.

@mlynch
Created May 16, 2012 14:42
Show Gist options
  • Save mlynch/2710867 to your computer and use it in GitHub Desktop.
Save mlynch/2710867 to your computer and use it in GitHub Desktop.
Example request handler
def _v1_user_app(request, appid):
# check authentication
if request.method == "POST":
try:
app_parsed = json.loads(request.raw_post_data)
# app_parsed is now a dictionary or hash object
# ...
return HttpResponse() # OK!
except:
# ...
elif request.method == "GET":
app = get_app_from_id(request.user, appid) # get app from database
return json_response({
'name': app.name,
...
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment