Requests PUT method doesn't send keys properly

30 views Asked by At

I'm trying to create a PUT request using the lib requests. The request is working properly when i send the data through POSTMAN, but it doesn't work with Python requests.

Here's what i've tried:

jsn = {'key 1' :'item 01', 'key 2' :'item 02', 'key 3' :'item 03'}
i = jsn
headers = {'Authorization-Token': token , 'User': user , 'App':'API' }
params = {'Content-Type': 'application/json'}
url = url
data = {'pedido':i}
request_put = requests.put(url, headers = headers, params = params, data = data)
print (request_put.text)

When i run the code i receive a message: <Response [200]> ""Couldn't locate key 3""

Any ideas on where i could have messed up?

0

There are 0 answers