首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Python 3.3 HTTP Cookie错误

Python 3.3 HTTP Cookie错误
EN

Stack Overflow用户
提问于 2012-09-30 16:28:19
回答 1查看 591关注 0票数 1

我刚刚(从源代码)全新安装了Python3.3,并安装了'requests‘库。我正在尝试一个非常简单的请求:

代码语言:javascript
复制
r = requests.get('https://www.google.com/')

我得到了一个非常奇怪的错误:

代码语言:javascript
复制
File "/usr/local/lib/python3.3/http/cookiejar.py", line 1647, in extract_cookies
  if self._policy.set_ok(cookie, request):
File "/usr/local/lib/python3.3/http/cookiejar.py", line 931, in set_ok
  if not fn(cookie, request):
File "/usr/local/lib/python3.3/http/cookiejar.py", line 952, in set_ok_verifiability
  if request.unverifiable and is_third_party(request):
AttributeError: 'MockRequest' object has no attribute 'unverifiable'

由于我在某种程度上还是Python初学者,我完全不知道是什么导致了这个错误。有什么想法吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-09-30 16:50:24

这在python 3.2中有效:

代码语言:javascript
复制
Python 3.2.3 (default, Apr 13 2012, 13:31:19) 
[GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.12)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> r = requests.get('https://www.google.com/')

requests FAQ声明了正式支持的Python3版本,您刚刚发现在Python3.3上,requests (还没有)工作。

问题跟踪器中有一个patch available,所以这只是时间问题。

更新Version 0.14.1已于2012/10/01发布,并已修复:

0.14.1 (2012-10-01)

  • Python 3.3 Compatibility
  • Simply默认accept-encoding
  • Bugfixes
票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12659833

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档