Python Assign Literal Value Of A Dictionary To Key Of Another Dictionary
I am trying to form a web payload for a particular request body but unable to get it right. What I need is to pass my body data as below data={'file-data':{'key1': '3','key2': '6
Solution 1:
If you want to post JSON with python requests, you should NOT use data
but json
:
r = requests.post('http://httpbin.org/post', json={"key": "value"})
I can only guess that you are using data
because of your example
payload={url,headers, data={'file-data':{"key1": "3","key2": "6","key3": "8"}},files=files}
Whis is not valid python syntax btw.
Post a Comment for "Python Assign Literal Value Of A Dictionary To Key Of Another Dictionary"