Python3.x执行POST请求是出现POST data should be bytes or an iterable of bytes. It cannot be of type str.错误
来源:互联网 发布:詹姆斯季后赛数据排名 编辑:程序博客网 时间:2024/06/05 07:31
在使用Python3.6.1做一个小型爬虫时出现了下面的错误:
开始我是这么写的:data = urllib.parse.urlencode(values),出现了上面的那种错误。values为POST请求的数据。
研究错误日志发现是请求的数据的类型出现的问题,应该指定一种编码格式进行编码。
最后将代码更改为如下形式后问题得到解决:
data = urllib.parse.urlencode(values).encode(encoding=’UTF8’)
阅读全文
1 0
- Python3.x执行POST请求是出现POST data should be bytes or an iterable of bytes. It cannot be of type str.错误
- python3.x执行post请求时报错“POST data should be bytes or an iterable of bytes...”的解决方法
- TypeError: POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type s
- 解决Python3.6,发送POST请求错误提示:POST data should be bytes, an iterable of bytes, or a file object. It canno
- python3爬虫问题 POST data should be bytes or an iterable of bytes
- python3爬虫问题 POST data should be bytes or an iterable of bytes
- Python之Headers value 1 must be of type str or bytes, not <class 'int'>错误的解决
- python3-网络编程-TypeError: send() argument 1 must be bytes or buffer, not str异常
- Property or field 'str' cannot be found on object of type 'com.yubai.EL.DemoService'
- 错误:Property or field 'default' cannot be found on object of type 'com.netflix.appinfo.InstanceInfo'
- TypeError: must be str, not bytes
- write() argument must be str, not bytes
- TypeError: must be str, not bytes
- python3环境下 tensorflow环境中经常遇到'*' has type str, but expected one of: bytes问题的解决
- The type OneInterface cannot be a superinterface of OneInterfaceImpl; a superinterface must be an in
- storm错误:msg:Field drpc.servers must be an Iterable of java.lang.String
- can't use a string pattern on a bytes-like object错误和must be str, not bytes错误
- BEA weblogic 处理请求出现错误:Cannot parse POST parameters of request
- gcd
- 牛客剑指offer刷题记录(四)
- http协议
- 二叉搜索树的后续遍历
- Python空间数据处理3: HDF格式转GDAL支持格式
- Python3.x执行POST请求是出现POST data should be bytes or an iterable of bytes. It cannot be of type str.错误
- Android系列之自定义Button控件
- Hibernate绑定session
- Java两种实现多线程方式的比较( implements Runnable 与 extends Thread )
- 后缀平衡树
- Construct String from Binary Tree(tag:String)
- 2.前端常见面试编程题整理
- Hibernate的api使用
- 后缀自动机