Pergunta

Eu apenas fiz uma instalação nova (de origem) do Python 3.3 e eu instalei o 'pedidos' biblioteca.Eu estou tentando muito simples pedido:

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

E eu estou ficando muito estranho erro no retorno:

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'

Vendo como eu ainda estou um pouco um iniciante em Python, eu não tenho absolutamente nenhuma idéia o que está causando esse erro.Qualquer idéias?

Foi útil?

Solução

Isso funciona em 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/')

O requests Perguntas frequentes estados python 3 é suportado até a versão 3.2, e você acabou de saber sobre python 3.3, requests (ainda) não trabalho.

Há um patch disponível no issue tracker, então é só uma questão de tempo.

Atualização: Versão 0.14.1 foi lançado em 2012/10/01, com a correção:

0.14.1 (2012-10-01)

  • Python 3.3 Compatibilidade
  • Basta padrão accept-encoding
  • Correções de bugs
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top