sigmavirus24 / github3.py

Hi, I'm a library for interacting with GItHub's REST API in a convenient and ergonomic way. I work on Python 3.6+.
https://github3.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.21k stars 404 forks source link

error listing repos; ssl version 5 not in _ssl_versions #437

Closed kbroughton closed 9 years ago

kbroughton commented 9 years ago

I'm running on a mac gh3.version Out[96]: '1.0.0a2'

(master)][conda_py2] openssl OpenSSL> version OpenSSL 1.0.1k 8 Jan 2015

In an Ipython Notebook (python 2.7 conda install)

Cell 3 from docker import tls repo = gh.repository("MyOrg", "myRepo") DOCKER_CERT_PATH="/Path/To/.docker/machine/machines/mymachine/ca.pem" tls_config = tls.TLSConfig(ca_cert=DOCKER_CERT_PATH)

Cell 4

%debug from docker import Client cli = Client(base_url='https://192.168.99.102:2376', tls=tls_config) cli.images()

Out 4

/Users/kestenbroughton/anaconda/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py(255)ssl_wrap_socket() 254 ssl_version=None): --> 255 ctx = OpenSSL.SSL.Context(_openssl_versions[ssl_version]) 256 if certfile:

ipdb> ssl_version 5 ipdb> _openssl_versions {1: 2, 2: 3, 3: 4}

Cell 2

%debug cli = Client(base_url='https://192.168.99.102:2376') cli.images()

Out 2

/Users/kestenbroughton/anaconda/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py(314)_raise_timeout() 313 # http://bugs.python.org/issue10272> --> 314 if 'timed out' in str(err) or 'did not complete (read)' in str(err): # Python 2.6 315 raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)

ipdb> url '/v1.19/images/json?only_ids=0&all=0' ipdb> str(err) * TypeError: str** returned non-string (type Error)

I switched to using https rather than tcp on advice from a stack overflow on this error. Should docs be updated?

Cell 1 cli = Client(base_url='tcp://192.168.99.102:2376') cli.images()

Out 1 /Users/kestenbroughton/anaconda/lib/python2.7/site-packages/requests/sessions.pyc in send(self, request, _kwargs) 571 572 # Send the request --> 573 r = adapter.send(request, _kwargs) 574 575 # Total elapsed time of the request (approximately)

/Users/kestenbroughton/anaconda/lib/python2.7/site-packages/requests/adapters.pyc in send(self, request, stream, timeout, verify, cert, proxies) 413 414 except (ProtocolError, socket.error) as err: --> 415 raise ConnectionError(err, request=request) 416 417 except MaxRetryError as e:

ConnectionError: ('Connection aborted.', BadStatusLine('\x15\x03\x01\x00\x02\x02\n',))

sigmavirus24 commented 9 years ago

This is a bug in urllib3 that will be fixed by this pull request.