我正在使用python请求调用API,响应代码为200。对于相同的数据和发布请求,Postman返回的状态码为201。
如何在python中达到201?
Python中的示例代码:
base_url=https://domain-name.com/api/import/
list=["9273e6b66c9487bda40b6090492407f", "610a28885cd1f8f4cb04ee20440e42f3"]
action="add"
headers = {
'Authorization': api_key,
'Content-Type':'application/json',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'
}
payload = {
"md5s": list,
"action": action
}
response = requests.post(base_url,headers=headers,data=json.dumps(payload))
有人可以指出我哪里出了问题吗?
下面是邮递区号:
POST /api/import/ HTTP/1.1
Host: domain-name.com
Authorization: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx
{"md5s":["9273e6b66c9487bda40b6090492407f", "610a28885cd1f8f4cb04ee20440e42f3"],"action":"add"}
谢谢