1👍
✅
Explicitly encode the dictionary to prevent form-encoding. Otherwise, it will be form-encoded as the way similar to urllib.urlencode
(or urllib.parse.urlencode
in Python 3.x).
import json
...
requests.options(
headers.kwargs['url'], headers=headers.headers,
data=json.dumps({'parent': {'id': 'xxxx'}, 'name': 'name.pdf'}))
In other word, instead of passing a dictionary, pass a string.
According to More complicated POST requests – Request documentation:
…
There are many times that you want to send data that is not
form-encoded. If you pass in a string instead of a dict, that data
will be posted directly.
Source:stackexchange.com