Skip to content

Instantly share code, notes, and snippets.

@nkentaro
Created February 15, 2017 08:55
Show Gist options
  • Save nkentaro/85c10a79fa531544a7d734c8c63ff447 to your computer and use it in GitHub Desktop.
Save nkentaro/85c10a79fa531544a7d734c8c63ff447 to your computer and use it in GitHub Desktop.
Retrieve Django's HttpRequest body as text string
def some_view(request):
# HttpRequest.body is byte string
body = request.body.decode('utf-8')
# now body can be handled as a string
.....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment