python - 能够使用 POSTMAN 访问端点,但不能使用 PYTHON
问题描述
我有一个 POST 端点,如下所示:
http://localhost:8080/*****/***********/orders/k137982151
我在 POSTMAN 上收到了成功的回复。
我使用 POSTMAN 生成了一个 python 代码片段,如下所示:
import requests
url = "http://localhost:8080/*****/***********/orders/k137982151"
headers = {
'content-type': "application/x-www-form-urlencoded",
'cache-control': "no-cache",
'postman-token': "********-*****-***-****-********"
}
response = requests.request("POST", url, headers=headers)
print(response.status_code)
结果我得到了404。我也尝试过使用 urllib。我仍然得到 404。我错过了什么?
解决方案
推荐阅读
- c++ - 从列表 C++ 创建队列
- meson-build - 在 Meson 中将 @BASENAME@ 与 custom_target() 的 install_dir 一起使用
- excel - 在完成之前在宏之后运行宏列表
- typescript - 在 TypeScript 中通过字符串设置枚举类型的变量
- r - 如何使用 dplyr 创建一个以 R 中其他两列的出现为条件的新列?
- python - 在 Python 中使用 Excel 列并定义哪个是 x 和 y
- pdf - 跟踪 PDF 文档的读者群
- html - 导航栏在应用位置后更改其位置:对其进行固定值
- git - Git:删除损坏的存储
- python - 如何将 python 命令作为用户的输入并将其功能作为输出