Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All queries fail with SSLError #96

Closed
tiagopereira opened this issue Apr 12, 2017 · 8 comments
Closed

All queries fail with SSLError #96

tiagopereira opened this issue Apr 12, 2017 · 8 comments

Comments

@tiagopereira
Copy link

Hi Andy,

Just installed ads, but can't seem to do anything yet. All the queries I try (even using sandbox) end up with a SSLError: ('bad handshake: WantWriteError()',).

Expected Behavior

As per the documentation, I expect that the following will work:

>>> import ads.sandbox as ads
>>> q = ads.SearchQuery(q='star')
>>> for paper in q:
>>>     print(paper.title, paper.citation_count)

Current Behavior

But I get the following traceback:

WantWriteError                            Traceback (most recent call last)
/Users/tiago/anaconda/envs/python3/lib/python3.6/site-packages/requests/packages/urllib3/contrib/pyopenssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname)
    435             try:
--> 436                 cnx.do_handshake()
    437             except OpenSSL.SSL.WantReadError:

/Users/tiago/anaconda/envs/python3/lib/python3.6/site-packages/OpenSSL/SSL.py in do_handshake(self)
   1425         result = _lib.SSL_do_handshake(self._ssl)
-> 1426         self._raise_ssl_error(self._ssl, result)
   1427

/Users/tiago/anaconda/envs/python3/lib/python3.6/site-packages/OpenSSL/SSL.py in _raise_ssl_error(self, ssl, result)
   1150         elif error == _lib.SSL_ERROR_WANT_WRITE:
-> 1151             raise WantWriteError()
   1152         elif error == _lib.SSL_ERROR_ZERO_RETURN:

WantWriteError:

During handling of the above exception, another exception occurred:

followed by a few other SSLError: ('bad handshake: WantWriteError()',) errors.

Your Environment

  • ads from pip (v. 0.12.3)
  • Tried with anaconda in python 2.7.12 and 3.6.0 (all latest versions).
  • pyopenssl 16.2.0
  • requests 2.13.0
@vsudilov
Copy link
Collaborator

Cannot repro in python 2.7.12 on ubuntu16, latest develop code, hitting live endpoint:

In [10]: q = ads.SearchQuery(q="star")

In [11]: list(q)[0].title
Out[11]: [u'Direct photon measurement in proton-proton and deuteron-gold collisions']

However, using the same commands above after import ads.sandbox as ads produces SSLError: ("bad handshake: SysCallError(32, 'EPIPE')",)

@tiagopereira
Copy link
Author

Forgot to add that the above was on a Mac. I just checked again in Linux and I get the same SSLError as @vsudilov . Indeed it seems only the sandbox is broken (earlier I got the same SSLErorr also on ads.SearcQuery, but now it seems to be working...

@vsudilov
Copy link
Collaborator

vsudilov commented Apr 12, 2017

I think this is related to ADS updating their certs recently and some interaction with local cert stores; Cannot repro in a vanilla ubuntu docker container.

import ads.sandbox as ads
q = ads.SearchQuery(q="star")
list(q)[0].title
[u"Cyclic Adenosine 3',5'-Monophosphate during Glucose Repression in the Rat Liver"]

@jonnybazookatone
Copy link
Collaborator

jonnybazookatone commented Apr 12, 2017

I confirm my Mac also fails for the latest build. Rolling back requests to requests==2.11.1 makes it work again. Not sure why atm....

@jonnybazookatone
Copy link
Collaborator

Fails for sandbox, not live.

@jonnybazookatone
Copy link
Collaborator

jonnybazookatone commented Apr 13, 2017

I had a quick look, it seems there is an SSL issue somewhere in HTTPretty:

>>> import requests
>>> import HTTPretty as hp
>>> hp.enable()
>>> hp.register_uri(hp.GET, 'https://foo.com', body='''{"return": "success"}''')
>>> requests.get('https://foo.com').json()   
....
    495         except (_SSLError, _HTTPError) as e:
    496             if isinstance(e, _SSLError):
--> 497                 raise SSLError(e, request=request)
    498             elif isinstance(e, ReadTimeoutError):
    499                 raise ReadTimeout(e, request=request)

SSLError: ('bad handshake: WantWriteError()',)

It may be related to this issue: gabrielfalcao/HTTPretty#242 but I didn't dig too deep. There is a PR open to fix this, but they're waiting on gabrielfalcao to merge it.

@vsudilov
Copy link
Collaborator

Closing; if this is on-going we can investigate more

@jonnybazookatone
Copy link
Collaborator

Seems fine for me on Mac OS, python2.7, python3.5 and Linux python2.7, python3.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants