Form Encoded Data
suggest changefrom requests import post
payload = {'key1' : 'value1',
'key2' : 'value2'
}
foo = post('http://httpbin.org/post', data=payload)
To pass form-encoded data with the post operation, data must be structured as a dictionary and supplied as the data parameter.
If the data should not be form-encoded, pass a string or bytes as the data parameter. An integer is not accepted.
Supply the dictionary to the json parameter for Requests to format the data automatically:
from requests import post
payload = {'key1' : 'value1', 'key2' : 'value2'}
foo = post('http://httpbin.org/post', json=payload)
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents