Python请求模块返回200,但未写入任何数据

时间:2019-12-01 06:04:40

标签: python python-requests

我正在将Python 3.7与请求模块2.22.0一起使用

以下是我在python中的代码:

data = { "id": 35, "name": "sample", "user": 1, "account": 3, 
"auto_remove_resource": "N", "generations": 30, "enabled": True, 
"schedules": [1], "description": "" }

response = requests.post( url=url, json={"json_payload": data}, 
headers=headers, verify=False )

print(response.status_code)

它返回200以获取执行结果,但给出301以进行后期请求。相同的帖子与邮递员一起很好地工作。

DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): 
DEBUG:urllib3.connectionpool: "POST url HTTP/1.1" 301 0 
DEBUG:urllib3.connectionpool:"GET url HTTP/1.1" 200 3718 200

我给了以下标题

headers = { "Accept": "application/json;", "Content-Type": 
"application/json", "Authorization": "Bearer {}".format(mytoken), }

任何帮助将不胜感激吗?

0 个答案:

没有答案