Cant update dns record, error "Request body is invalid"

I can not update the dns record

def updateRecord(ip):
    data = {
        "type": "A",
        "name": domain, # fqdn
        "content": ip,
        "ttl": 1, # or removed or "auto" > same error
        "proxied": True

    r = requests.put(

    print(r.content) # {"result":null,"success":false,"errors":[{"code":9207,"message":"Request body is invalid."}],"messages":[]}

Can someone tell me where the error is?

If you pass a dict as the data parameter it gets serialized to a URL-encoded form:, data={'hello':'world'})hello=world

If you want to send a JSON object you must pass a string:, data=json.dumps({'hello':'world'})){"hello":"world"}

Alternatively, you can use the json parameter instead:, json={'hello':'world'}){"hello":"world"}