1. 首页
  2. 数据库
  3. 其它
  4. 解决Python requests库编码 socks5代理的问题

解决Python requests库编码 socks5代理的问题

上传者: 2020-12-29 22:58:13上传 PDF文件 125.36KB 热度 39次
编码问题 response = requests.get(URL, params=params, headers=headers, timeout=10) print 'self.encoding',response.encoding output: self.encoding ISO-8859-1 查了一些相关的资料,看了下requests的源码,只有在服务器响应的头部包含有Content-Type,且里面有charset信息,requests能够正确识别,否则就会使用默认的 ISO-8859-1编码。github中也有讨论这个问题,但requests的作者们说是根据rfc来
下载地址
用户评论