Already looked at here, here and here but still having issues.
I have a POST data
that looks like this:
{
"config":{
"param1": "param1 value",
"param2": "param2 value",
"param3": "param3 value"
},
"name": "Testing API",
"url": "https://testingapi.my.own.com",
"enabled": true
}
I have the following headers:
{
"Content-Type": "application/json",
"referer": "https://testingapi.my.own.com",
"X-CSRFToken": "my token value here"
}
How do format this for the session.post
?
I am keep getting the response code of 400
and logs are stating that I am not sending the required params in the post
request.
Here is the code:
headers = {"Content-Type": "application/json",
"referer": "https://testingapi.my.own.com",
"X-CSRFToken": "my token"
}
request_data = {
"config":{
"param1": "param1 value",
"param2": "param2 value",
"param3": "param3 value"
},
"name": "Testing API",
"url": "https://testingapi.my.own.com",
"enabled": "true"
}
#tried the following:
r = session.post(url, data = request_data, headers=headers)
r = session.post(url, json = json.dumps(request_data), headers=headers)