Python post请求报错 Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported
Python用post方式请求接口数据的时候,报错:
Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported
这是由于没有设置 Content-Type 的原因。
在headers在添加:
header = {'Content-Type':'application/json;charset=UTF-8'}
传入到request请求中便解决问题。