Python requests and OpenSSL - HTTPSConnectionPool Max retries exceeded -


i have problem using python requests library in ubuntu 14.04 when execute following script:

import requests import json  payload = {'code':'tg-000000000000000000000000', 'client_secret':'x0000000000000000000000000000000', 'grant_type':'authorization_code', 'client_id':'1111111111111111', 'redirect_uri':'http://127.0.0.1:8000/mercadolibre/process_ml_response/'} headers = {'content-type': 'application/x-www-form-urlencoded'} requests.post("https://api.mercadolibre.com:443/oauth/token", data=payload, headers=headers) 

i following traceback

  file "<stdin>", line 1, in <module>   file "/home/theuser/.virtualenvs/tumoto/local/lib/python2.7/site-packages/requests/api.py", line 88, in post     return request('post', url, data=data, **kwargs)   file "/home/theuser/.virtualenvs/tumoto/local/lib/python2.7/site-packages/requests/api.py", line 44, in request     return session.request(method=method, url=url, **kwargs)   file "/home/theuser/.virtualenvs/tumoto/local/lib/python2.7/site-packages/requests/sessions.py", line 456, in request     resp = self.send(prep, **send_kwargs)   file "/home/theuser/.virtualenvs/tumoto/local/lib/python2.7/site-packages/requests/sessions.py", line 559, in send     r = adapter.send(request, **kwargs)   file "/home/theuser/.virtualenvs/tumoto/local/lib/python2.7/site-packages/requests/adapters.py", line 375, in send     raise connectionerror(e, request=request) requests.exceptions.connectionerror: httpsconnectionpool(host='api.mercadolibre.com', port=443): max retries exceeded url: /oauth/token (caused <class 'socket.error'>: [errno 104] connection reset peer) 

if try same code in ubuntu 13.10 works fine

i guest error related version of openssl (1.0.1f) , requests python library

i try installing pyopenssl, ndg-httpsclient , pyasn1 suggested in using requests tls doesn't give sni support doesn't work, apply monkey patch before run script fails

note: when use pyopenssl new error is:

request.exceptions.sslerror: [errno bad handshake](104, 'econnreset')  

thanks suggestion

i found fork of requests works fine openssl version of ubuntu 14.04, https://github.com/joequery/requests-sslv3 install fork via pip , requests works again


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -