Created
May 16, 2012 14:42
-
-
Save mlynch/2710867 to your computer and use it in GitHub Desktop.
Example request handler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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