Convert WSGIRequest to JSON

django, httprequest, python

Solution

You can dump `request.__dict__` instead of request, but it's not give you full-depth representation of object.

Problem

While making a custom middleware for storing HTTP Requests in Django project i came across a trouble that WSGIRequest object is not JSON serializable. I'm trying to do it like this: ``` import json class StoringHttpRequestsMiddleware(object): def process_request(self, request): print('Request looks like this - ') print json.dumps(request, separators=(',',':')) return ``` Should i perform parsing by myself or there are some ways to do it? Thanks.

Original source