Skip to content

Instantly share code, notes, and snippets.

View adamcharnock's full-sized avatar

Adam Charnock adamcharnock

View GitHub Profile
@adamcharnock
adamcharnock / pretty_request.py
Created December 13, 2018 12:51 — forked from defrex/pretty_request.py
A simple function to print a Django request the way requests are meant to be printed.
def pretty_request(request):
headers = ''
for header, value in request.META.items():
if not header.startswith('HTTP'):
continue
header = '-'.join([h.capitalize() for h in header[5:].lower().split('_')])
headers += '{}: {}\n'.format(header, value)
return (