HTTP请求415错误 – 不支持的媒体类型(Unsupported media type)
通常有以下情况:
1:检查你的 http 请求头信息,比如 因为 User-Agent 被服务器设置 拒绝请求了;
比如你写的的爬虫,就很有可能因为没有伪装成浏览器,被拒绝请求
2:查看你的 http 请求方法,以及服务器端的设置
比如:有一个 强制用 post 请求的接口,你是不是用了非post 请求
3:post 请求参数设置,是不是必须的,json 格式
比如下面,两段代码,
如下 json参数,body
对 headers 添加 content-type 类型 application/json
headers={‘content-type‘: ‘application/json‘}