Hi guys,
I am writing a program in python + flask, which among other things uses python requests to interact with cloudflare api. However I am having a little difficulty getting the POST command to create a new dns record.
So this works:
requests.get(url, headers=headers) # where the url is a string and the headers is a dict obj
And this works:
requests.put(url + ‘/’ + item[‘id’], headers=headers, json=data) # data is a dict that is sent as json
But this wont work:
requests.post(url, headers=headers, json=data)
All the url, headers and data fields are assembled in the same function before being passed to the requests method, so I’m not sure what is going wrong. I have gotten maybe 2 or 3 ‘200’ responses that don’t actually work, but mostly just get ‘400’ bad request.
Any ideas?