【发布时间】:2021-08-23 03:51:47
【问题描述】:
为什么当我将它与 react 和 java android 一起使用时相同的 api API 我没有收到错误 415 但是当我使用 python 请求时我收到一个错误:“title”:“Unsupported Media Type”,“status” :415
URL = "http://localhost:44327/api/UserOfficial/UserOfficialAuthenticate"
def Login():
data = {
'username': 'hienkieu',
'password': '197353995'
}
length = len(json.dumps(data))
hearder = {
'accept': 'application/json',
'content-Type' : 'application/json',
'content-Length': length
}
r = requests.post(URL, data, hearder)
return r.text
【问题讨论】:
标签: python http-status-code-415