【发布时间】:2019-09-06 19:52:00
【问题描述】:
我正在编写一个将 POST 到端点的 python 脚本,但由于某种原因,我收到 400 Bad Request。我不确定我在这里缺少什么。我的代码如下:更新代码以包含引用者,但我得到了同样的错误。我保持参考 URL 与帖子 URL 相同
import requests
import csv
import simplejson
import json
url = 'https://xyz.io/v1/candidates'
headers = {'content-type': 'application/json',
'On-Behalf-Of':'{334401}',
'Authorization':'Ommited'
'referer': 'https://xyz.io/v1/candidates'
}
data={
"first_name": "IamTest",
"last_name": "IamTest"
}
response = requests.post(url,data=data,headers=headers)
print(response)
print(response.reason)
【问题讨论】:
标签: python-3.x post python-requests