当前位置:首页 > python > 正文内容

Python post请求报错 Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported

zhangsir3年前 (2022-08-23)python396

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请求中便解决问题。



zhangsir版权g4防采集https://mianka.xyz

扫描二维码推送至手机访问。

版权声明:本文由zhangsir or zhangmaam发布,如需转载请注明出处。

本文链接:https://mianka.xyz/post/14.html

标签: python
分享给朋友:

“Python post请求报错 Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported” 的相关文章

Selenium添加Cookie来实现自动登录

Selenium添加Cookie来实现自动登录第一步获取你登录的cookie,以csdn为例from selenium import webdriver driver = webdriver.Chrome() driver.get('...

Python三方库ddddocr实现验证码识别

Python三方库ddddocr实现验证码识别环境要求python >= 3.8安装三方库pip install ddddocr -i https://pypi.tuna.tsinghua.edu.cn/simple参数说明:参数名参数类型默认值说明us...

pip安装三方库 国内的一些镜像站点推荐

pip 国内的一些镜像站点推荐镜像套路:使用cmd;输入命令pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple 包名 即可开始安装。清华:https://pypi.tuna.tsinghua.edu.cn/simple 阿里云:http...

python selenium find_element_by_xpath 方法已经被弃用的解决办法

背景:在使用最新3.10.4Python版本时候,用selenium进行xpath定位元素,编译器提示:DeprecationWarning:find_element_by_xpath is deprecated. Please use find_element(by=By.XPATH, value...

python 给电脑设置闹钟

python会自动触发windows桌面通知,提示重要事项,比如说:您已工作两小时,该休息了我们可以设定固定时间提示,比如隔10分钟、1小时等用到的第三方库:win10toast - 用于发送桌面通知的工具from win10toast import ToastNoti...

计算机学习视频教程

人工智能机器学习:Python&R实践课程介绍:https://www.aihorizon.cn/1百度网盘地址: https://pan.baidu.com/s/1a743NTKFRjsgexMTagWooA?pwd=e39j动手使用Python进行自然语言处理(NLP)课程介绍:http...