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

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

zhangsir4年前 (2022-08-23)python442

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版权a1防采集https://mianka.xyz

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

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

本文链接:https://www.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之seleniumwire获取network(网络)信息

python之seleniumwire获取请求头参数import time from seleniumwire import webdriver # 创建Chrome驱动程序的新实例 driver = webdriver...

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

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

python 多线程与多进程的代码实例

一.两者区别多进程和多线程的主要区别是:线程是进程的子集(部分),一个进程可能由多个线程组成。多进程的数据是分开的、共享复杂,需要用IPC;但同步简单。多线程共享进程数据,共享简单;但同步复杂。(1)多进程进程是程序在计算机上的一次执行活动,即正在运行中的应用程序,通常称为进程。当你运行一个程序,你...

Linux系统下使用Python+selenium+谷歌浏览器下载文件

from seleniumwire import webdriver import time ch_options = webdriver.ChromeOptions() ch_options.add_argument("-...

python 实现快速扣背景图功能

一,实现快速扣背景图需要rembg这个三方库#引入rembg库 from rembg import remove #素材 input_path = 'input.jpg' #效果 output_path =&nbs...