Skip to content

Instantly share code, notes, and snippets.

@shofetim
Created May 20, 2015 22:07
Show Gist options
  • Select an option

  • Save shofetim/3255d2f23f50b1979389 to your computer and use it in GitHub Desktop.

Select an option

Save shofetim/3255d2f23f50b1979389 to your computer and use it in GitHub Desktop.
def login(request):
try:
payload = json.loads(request.body)
except ValueError as error:
return JsonResponse.bad_request(message=unicode(error))
username = payload.get('username', False)
password = payload.get('password', False)
if username and password:
else:
return JsonResponse.bad_request(message=unicode('Malformed request'))
return JsonResponse(data={'success':True})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment