I want to make PUT request in Python using JSON data as
data = [{"$TestKey": 4},{"$TestKey": 5}]
Is there any way to do this?
import requests
import json
url = 'http://localhost:6061/data/'
data = '[{"$key": 8},{"$key": 7}]'
headers = {"Content-Type": "application/json"}
response = requests.put(url, data=json.dumps(data), headers=headers)
res = response.json()
print(res)
Getting this error
requests.exceptions.InvalidHeader: Value for header {data: [{'$key': 4}, {'$key': 5}]} must be of type str or bytes, not <class 'list'>