Search code examples
pythonhttppython-requestspython-3.3

Python 3.3 HTTP Cookie Error


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'

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


Solution

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

    The requests FAQ states what python 3 versions are officially supported, 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.

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

    0.14.1 (2012-10-01)

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