在发送HTTP请求时,用post或者put方法时可能会出现415的错误,解决方法:
只需要在请求头中加入如下字段即可:
"Content-Type":"application/json"
完整的请求头如下:
headers = {
"Content-Type":
"application/json",
"Accept":
"application/json, text/javascript, */*; q=0.01",
"User-Agent":
"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36"
}