我想使用python请求将一个多部分/表单数据作为post正文发送,但我并没有收到错误的请求问题
import requests
headers = {"Content-Type": "multipart/form-data"}
data = {
"@context": "http://semantro.com/", "@type": "KiranaSearch", "actionName": "listCategoryProducts",
"pageLimit": {"@context": "http://semantro.com/", "@type": "PageProperty", "start": 0, "end": 24},
"data": {"@context": "http://semantro.com/", "@type": "KiranaCategory",
"identifier": "c5394d1d5c6c4cb8-adc77dd996876dba"}
}
response = requests.post('https://merokirana.com/semantro-web-interface/query',
data=data, headers=headers)
print(response.text)
回应
{
"statusTitle" : "ServiceUnsuccessful",
"statusMessage" : "Invalid type of data received. The request should have multipart query data.",
"@context" : "http://semantro.com",
"@type" : "RemoteServiceStatus"
}
但我可以使用相同的formdata使用postman检索所需的数据
输出:
相关问题 更多 >
编程相关推荐