Python 3.3 HTTP Cookie错误

时间:2012-09-30 08:28:19

标签: python http python-requests python-3.3

我刚刚完成了Python 3.3的全新安装(来自源代码)并安装了'requests'库。我正在尝试一个非常简单的请求:

r = requests.get('https://www.google.com/')

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

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初学者,我完全不知道是什么导致了这个错误。有什么想法吗?

1 个答案:

答案 0 :(得分:6)

这适用于python 3.2:

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/')

版本3.2支持requests FAQ状态python 3,你刚刚在python 3.3上发现,requests尚未工作。

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

更新Version 0.14.1于2012/10/01发布,其中包含修复程序:

  

0.14.1(2012-10-01)

     
      
  • Python 3.3兼容性
  •   
  • 只需默认接受编码
  •   
  • 错误修正
  •