首页 > 解决方案 > 能够使用 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。我错过了什么?

标签: pythonpostpostmangoogle-colaboratory

解决方案


推荐阅读