为什么我有get方法而不是post方法?

时间:2020-08-16 16:52:28

标签: python django post python-requests celery

我有一个使用http的网站,并且一切正常,但是现在我将http更新为https协议,并且在芹菜任务中遇到了以下问题:

b'{"detail":"Method \\"GET\\" no allowed."}'

这是我使用post的一行:

requests.post('https://localhost/api/update', data=data, headers={'Content-Type': 'application/json'})

我不知道为什么我使用POST方法时为什么GET方法有问题。

能帮我吗?

非常感谢您!

1 个答案:

答案 0 :(得分:0)

API可能会将您重定向。

尝试参数

allow_redirects=false

在您的请求中,看看会发生什么。

或尝试

response.history

了解更多信息。