Python 3.3 HTTP Cookie错误 [英] Python 3.3 HTTP Cookie Error

查看:226
本文介绍了Python 3.3 HTTP Cookie错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I just did a fresh install (from source) of Python 3.3 and I installed the 'requests' library. I'm attempting a very simple request:

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

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

And I'm getting a very strange error in return:

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初学者,我完全不知道造成这个错误的原因。任何想法?

Seeing as I'm still somewhat a Python beginner, I have absolutely no idea what is causing this error. Any ideas?

推荐答案

这适用于python 3.2:

This works in 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/')

< a href =http://docs.python-requests.org/en/latest/community/faq/ =nofollow noreferrer> requests FAQ 状态python 3支持3.2版本,你刚刚发现python 3.3,请求还没有(还)工作。

The requests FAQ states python 3 is supported up to version 3.2, and you have just found out on python 3.3, requests does not (yet) work.

问题跟踪器中有补丁可用,因此这只是时间问题。

There is a patch available in the issue tracker, so it's only a matter of time.

更新版本0.14.1 于2012/10/01发布,修复:

Update: Version 0.14.1 was released on 2012/10/01, with the fix:


0.14.1(2012-10-01)




  • Python 3.3兼容性

  • 只需默认接受编码

  • 错误修正

0.14.1 (2012-10-01)

  • Python 3.3 Compatibility
  • Simply default accept-encoding
  • Bugfixes

这篇关于Python 3.3 HTTP Cookie错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆