{
"detail":"Unsupported media type \"text/plain\" in request."
}
答案 0 :(得分:1)
它的发生是由于您请求的内容类型。
例如:
标题->添加 键:“内容类型” 值:“ application / json”
答案 1 :(得分:1)
答案 2 :(得分:0)
def do(method ='get', data={}, is_json =True):
headers = {}
if is_json:
headers['content-type'] ='application/json'
data = json.dumps(data)
r = requests.request(method, ENDPOINT, data=data, headers = headers )
print(r.text)
print(r.status_code)
return r
do(method='post', data={"content": "some cool api ", 'user':1})