clarencecastillo / alfred-powerthesaurus

Search Powerthesaurus synonyms and antonyms from Alfred
MIT License
104 stars 14 forks source link

SSL connection fails (not sure if local python issue) #13

Open alisneaky opened 3 years ago

alisneaky commented 3 years ago

Disabling SSL verification didn't impact this. Checked the Cert status which was green.

UG Starting new HTTPS connection (1): api.powerthesaurus.org:443 From cffi callback <function _verify_callback at 0x1069129b0>: Traceback (most recent call last): File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/OpenSSL/SSL.py", line 309, in wrapper _lib.X509_up_ref(x509) AttributeError: 'module' object has no attribute 'X509_up_ref' 08:18:10 workflow.py:2080 ERROR HTTPSConnectionPool(host='api.powerthesaurus.org', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)) Traceback (most recent call last): File "/Users/ali-work/OneDrive - Telstra/Alfred Workflows/Alfred.alfredpreferences/workflows/user.workflow.B5FD5BEB-A9D5-4C41-8397-804617378D4A/workflow/workflow.py", line 2073, in run func(self) File "powerthesaurus.py", line 88, in main term = pt.search_query_match(query) File "/Users/ali-work/OneDrive - Telstra/Alfred Workflows/Alfred.alfredpreferences/workflows/user.workflow.B5FD5BEB-A9D5-4C41-8397-804617378D4A/api.py", line 118, in search_query_match terms = self.search_query(query) File "/Users/ali-work/OneDrive - Telstra/Alfred Workflows/Alfred.alfredpreferences/workflows/user.workflow.B5FD5BEB-A9D5-4C41-8397-804617378D4A/api.py", line 112, in search_query r = requests.post(self.api_url, json=params, headers=self.request_headers, verify=PowerThesaurus.VERIFY_SSL) File "./lib/requests/api.py", line 119, in post return request('post', url, data=data, json=json, **kwargs) File "./lib/requests/api.py", line 61, in request return session.request(method=method, url=url, **kwargs) File "./lib/requests/sessions.py", line 530, in request resp = self.send(prep, **send_kwargs) File "./lib/requests/sessions.py", line 643, in send r = adapter.send(request, **kwargs) File "./lib/requests/adapters.py", line 514, in send raise SSLError(e, request=request) SSLError: HTTPSConnectionPool(host='api.powerthesaurus.org', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),)) 08:18:10 workflow.py:2082 INFO for assistance, see: https://github.com/clarencecastillo/alfred-powerthesaurus 08:18:10 workflow.py:2103 DEBUG ---------- finished in 0.873s ---------- [08:18:10.890] Power Thesaurus[Script Filter] {"items": [{"valid": false, "subtitle": "HTTPSConnectionPool(host='api.powerthesaurus.org', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(\"bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)\",),))", "icon": {"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"}, "title": "Error in workflow 'Power Thesaurus'"}]}

alisneaky commented 3 years ago

I can see it's using my python 2.7 version instead of python 3 which i've also got installed. Any way to fix it?

clarencecastillo commented 3 years ago

I believe all Alfred-Workflow extensions use the pre-installed Python 2.7 so that's expected. As for the SSL error, the current certificate they send over is indeed valid.

Any chance your machine's date/time is not set correctly?

alisneaky commented 3 years ago

machine's date and time is correct. I've got other workflows calling api's fine. Changing the variable doesn't seem to have an effect either.

learn2reid commented 3 years ago

Having an issue suddenly with SSL as well.

SSLError: HTTPSConnectionPool(host='api.powerthesaurus.org', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)'),))
learn2reid commented 3 years ago

Having an issue suddenly with SSL as well.

SSLError: HTTPSConnectionPool(host='api.powerthesaurus.org', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)'),))

Fixed by installing requirements in workflow folder. The issue was: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings.

Update: this actually did not fix the problem. Any update?

leadingendeavors commented 3 years ago

I am getting this issue as well for the past few weeks. any leads on a fix?

paultiomosquito commented 3 years ago

I have been getting the error off and on and haven't been able to use the workflow for the past couple months. I did not have any success with setting the environment variable to false but when I hard-coded False for the VERIFY_SSL variable in in api.py, it solved the problem for me.

Not sure why SSL is erroring out because per the README, the SSL cert is verified: https://www.sslshopper.com/ssl-checker.html#hostname=api.powerthesaurus.org but I still had the problem.