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

Unexpected SSLError #109

Closed
avarudkar opened this issue May 10, 2018 · 3 comments
Closed

Unexpected SSLError #109

avarudkar opened this issue May 10, 2018 · 3 comments

Comments

@avarudkar
Copy link

I have been using pywit for a couple of weeks. It was working fine till now. However, today it gave me an unexpected "bad handshake" error. I tried regenerating my access token and working with the fresh one, but the error recurs.

Code and error:
client = Wit(access_token)
client.message('what is the weather in london?')

---------------------------------------------------------------------------
SSLError                                  Traceback (most recent call last)
<ipython-input-19-b32f93918d38> in <module>()
----> 1 client.message('what is the weather in london?')

/Users/...../miniconda2/lib/python2.7/site-packages/wit/wit.pyc in message(self, msg, context, n, verbose)
     66         if context:
     67             params['context'] = json.dumps(context)
---> 68         resp = req(self.logger, self.access_token, 'GET', '/message', params)
     69         return resp
     70 

/Users/...../miniconda2/lib/python2.7/site-packages/wit/wit.pyc in req(logger, access_token, meth, path, params, **kwargs)
     35         headers=headers,
     36         params=params,
---> 37         **kwargs
     38     )
     39     if rsp.status_code > 200:

/Users/...../miniconda2/lib/python2.7/site-packages/requests/api.pyc in request(method, url, **kwargs)
     56     # cases, and look like a memory leak in others.
     57     with sessions.Session() as session:
---> 58         return session.request(method=method, url=url, **kwargs)
     59 
     60 

/Users/...../miniconda2/lib/python2.7/site-packages/requests/sessions.pyc in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
    506         }
    507         send_kwargs.update(settings)
--> 508         resp = self.send(prep, **send_kwargs)
    509 
    510         return resp

/Users/...../miniconda2/lib/python2.7/site-packages/requests/sessions.pyc in send(self, request, **kwargs)
    616 
    617         # Send the request
--> 618         r = adapter.send(request, **kwargs)
    619 
    620         # Total elapsed time of the request (approximately)

/Users/...../miniconda2/lib/python2.7/site-packages/requests/adapters.pyc in send(self, request, stream, timeout, verify, cert, proxies)
    504             if isinstance(e.reason, _SSLError):
    505                 # This branch is for urllib3 v1.22 and later.
--> 506                 raise SSLError(e, request=request)
    507 
    508             raise ConnectionError(e, request=request)

SSLError: HTTPSConnectionPool(host='api.wit.ai', port=443): Max retries exceeded with url: /message?q=what+is+the+weather+in+london%3F (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),))

More info:
Python version 2.7.14
Wit Version: 5.1.0

Any ideas on why this is happening suddenly?

@blandinw
Copy link
Contributor

hi @avarudkar, I cannot reproduce your issue using pywit 5.1.0.

For reference, here is my code:

import wit
client = wit.Wit(access_token=MY_TOKEN)
print(client.message('fly from sfo to nyc'))

Did anything change on your side? Is the issue resolved? If not, please comment back, thank you

@avarudkar
Copy link
Author

hi @blandinw I am not sure what the problem is. Something may have changed on my side, but I haven't updated any packages or anything lately. I tried to run the code again this morning, but it gave me the same error. I will work with my system admin to find out if anything has changed at their end (although I highly doubt that). I will report back if it is resolved at my end. Thanks for responding!

@avarudkar
Copy link
Author

Just thinking out loud: could there be a compatibility issue with the API version? Pywit is 20160516, but my app is at 20180510.

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

2 participants