Python requests is having issues:
rs = requests.get(STREAM_URL, stream=True,headers=headers)
Process Process-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "oanda_streaming_pairs_server.py", line 287, in multistreamer
rs = requests.get(STREAM_URL, stream=True,headers=headers)
File "/usr/local/lib/python2.7/dist-packages/requests-2.12.0-py2.7.egg/requests/api.py", line 70, in get
return request('get', url, params=params, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests-2.12.0-py2.7.egg/requests/api.py", line 56, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests-2.12.0-py2.7.egg/requests/sessions.py", line 488, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests-2.12.0-py2.7.egg/requests/sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests-2.12.0-py2.7.egg/requests/adapters.py", line 423, in send
timeout=timeout
File "/usr/local/lib/python2.7/dist-packages/requests-2.12.0-py2.7.egg/requests/packages/urllib3/connectionpool.py", line 594, in urlopen
chunked=chunked)
File "/usr/local/lib/python2.7/dist-packages/requests-2.12.0-py2.7.egg/requests/packages/urllib3/connectionpool.py", line 350, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python2.7/dist-packages/requests-2.12.0-py2.7.egg/requests/packages/urllib3/connectionpool.py", line 835, in _validate_conn
conn.connect()
File "/usr/local/lib/python2.7/dist-packages/requests-2.12.0-py2.7.egg/requests/packages/urllib3/connection.py", line 330, in connect
cert = self.sock.getpeercert()
File "/usr/local/lib/python2.7/dist-packages/requests-2.12.0-py2.7.egg/requests/packages/urllib3/contrib/pyopenssl.py", line 324, in getpeercert
'subjectAltName': get_subj_alt_name(x509)
File "/usr/local/lib/python2.7/dist-packages/requests-2.12.0-py2.7.egg/requests/packages/urllib3/contrib/pyopenssl.py", line 166, in get_subj_alt_name
cert = _Certificate(openssl_backend, peer_cert._x509)
AttributeError: 'X509' object has no attribute '_x509'
In my case, it turned out that the version of pyOpenSSL was too old. My Ubuntu 14.4 was running version 0.13 of pyOpenSSL. I was getting the reported error with elasticsearch python library.
I had to update pyOpenSSL by running:
sudo pip install -U pyOpenSSL
You can check pyOpenSSL version with:
python -c 'import OpenSSL; print(OpenSSL.__version__)'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With