Problem with Webflow API Call by Python

I use Webflow API by Python 3.7. I try to update some items in collection and try to use put and patch requests as describe in your API describer. Unfortunately, I get error 400 every time. I try to use several option like encode, binarize, etc. There is no result, only error 400. I present part of my code, please let me know what’s my mistake:


import requests

headers = {

‘Authorization’: ‘Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’,

‘accept-version’: ‘1.0.0’,

‘Content-Type’: ‘application/json’,


data = ‘${\n “fields”: {\n “name”: “testname”,\n }\n }’

response = requests.patch(‘’, headers=headers, data=data)

response.status_code, response.text



‘{“msg”:“Invalid request body”,“code”:400,“name”:“ValidationError”,“path”:"/collections/5ce2ceab0b5f0b71f828c4ba/items/5ce2d1710b5f0bcfae28cd8c",“err”:“ValidationError: Invalid request body”}’)

I recommend using a tool like postman to work out your API calls and formatting them for various server side code implementations. They have a free plan that includes 1k calls per month.