请求有效负载: (假设空间在那里)
{input01: {Input: "adress", adress: "g", FirstName: "", LastName: ""}, Locale: "en"}
Locale:"en"
input01:{Input: "adress", adress: "g", FirstName: "", LastName: ""}
FirstName:""
adress:"g"
Input:"adress"
LastName:"
这是我的尝试(返回400)。
data = {
"input01": {
"Input": "adress",
"adress": "test",
"FirstName": "",
"LastName": ""
},
"Locale": "en"
}
r = requests.post(url, data=data)
print(str(r.text))
答案 0 :(得分:2)
您没有发布JSON。当您将字典传递给application/x-www-form-urlencoded
参数时,它将被编码为json
请求,而不是HTML表单的默认编码。
要发布JSON,请使用r = requests.post(url, json=data)
参数:
{{1}}