Using the python requests library I can issue a POST:
response = requests.post("https://httpbin.org", data = {"x": 100, "y": 200})
<Response [405]>
The returned requests.Response object still holds a reference to the original request.
response.request
<PreparedRequest [POST]>
This enables me to access the parameters of the request later on, e.g.:
response.request.body
'x=100&y=200'
However, the data which was originally passed as a dict has already been processed into a string which the server understands.
My goal is to back-convert the body into the original dict form.
Is it possible to do that without parsing the string explicitely, e.g. some library function?
I see that this thread URL query parameters to dict python answers a considerable part of this question, but there is a small difference. In the cited question the urllib is used to split the url into a path and a query string and convert the result in a dict. However, this question is about parsing a body of a POST request. So the split does not apply here.
You can use this to Convert Query string to dict
You can use this Simple Function:
find more information on : python: how to convert a query string to json string?