【发布时间】:2021-03-16 22:56:09
【问题描述】:
我需要从 Python 发出 PUT 请求,并且一直收到 HTTP 405 响应代码。任何指向下面代码的指针都会很棒。
filepath = './sdfdd/sdfdsst/xxxxxxxxxrrrarara.json'
with open(filepath) as fh:
mydata = fh.read()
response = requests.put('https://asdfs.sdf.sdfds.com',
data=mydata,
auth=('Authorization', 'Api-Token dsdfdsfsdfsdf'),
headers={'content-type':'application/json'},
params={'file': filepath},
allow_redirects=True
)
print(response)
【问题讨论】:
-
你做过什么研究吗?您认为错误 405 意味着什么?
-
是的,这确实与已更正和修复的不正确 api 端点有关。
标签: python-3.x rest python-requests