- 接口在postman中是正常的,但是在py中用requests库去调可能会出现500错误
可能是因为忘记加header
header = {'Content-Type': 'application/json'}
url = "http://10.11.000.000:0000/analyze/reportbyuuid"
l_uuid = list()
l_uuid.append("c6ec8986-c795-4382-ac88-ba066f6da900")
l_uuid.append("4235c452-093b-4e84-8a9c-f06c518d74e4")
print(l_uuid)
body = {'uuid': l_uuid}
json_data = json.dumps(body)
print(json_data)
# result = requests.post(url, data=json.dumps(data))
project_response = requests.post(url, data=json_data, headers=header)
print(project_response.text)
# print(project_response)
HTTP协议参考文档 https://docs.python-requests.org/zh_CN/latest/user/quickstart.html#post
|