clarencecastillo / alfred-powerthesaurus

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

SSL: CERTIFICATE_VERIFY_FAILED #6

Closed filipruisl closed 4 years ago

filipruisl commented 4 years ago

started getting this error today

` [10:20:46.781] Powerthesaurus[Script Filter] Queuing argument 'mandatory' [10:20:47.261] Powerthesaurus[Script Filter] Script with argv '(null)' finished [10:20:47.267] ERROR: Powerthesaurus[Script Filter] Code 1: . 10:20:46 workflow.py:2061 DEBUG ---------- Powerthesaurus (1.1.0) ---------- 10:20:46 powerthesaurus.py:87 DEBUG query : u'mandatory' u'syn' 10:20:46 powerthesaurus.py:42 DEBUG Cache key : u'mandatory' ['synonyms'] -> u'mandatory_synonyms' 10:20:47 workflow.py:2080 ERROR <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)> Traceback (most recent call last): File "/X/Alfred.alfredpreferences/workflows/user.workflow.E54F6BDA-2690-43D9-B913-30D45506A7BF/workflow/workflow.py", line 2073, in run func(self) File "powerthesaurus.py", line 103, in main max_age=CACHE_MAX_AGE) File "/X/Alfred.alfredpreferences/workflows/user.workflow.E54F6BDA-2690-43D9-B913-30D45506A7BF/workflow/workflow.py", line 1701, in cached_data data = data_func() File "powerthesaurus.py", line 76, in get_words r = web.get(APIURL + query.replace(" ", "") + "/" + query_type) File "/X/Alfred.alfredpreferences/workflows/user.workflow.E54F6BDA-2690-43D9-B913-30D45506A7BF/workflow/web.py", line 591, in get stream=stream) File "/X/Alfred.alfredpreferences/workflows/user.workflow.E54F6BDA-2690-43D9-B913-30D45506A7BF/workflow/web.py", line 579, in request return Response(req, stream) File "/X/Alfred.alfredpreferences/workflows/user.workflow.E54F6BDA-2690-43D9-B913-30D45506A7BF/workflow/web.py", line 223, in init self.raw = urllib2.urlopen(request) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen return opener.open(url, data, timeout) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 429, in open response = self._open(req, data) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 447, in _open '_open', req) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 407, in _call_chain result = func(*args) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1241, in https_open context=self._context) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1198, in do_open raise URLError(err) URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)> 10:20:47 workflow.py:2082 INFO for assistance, see: https://github.com/clarencecastillo/alfred-powerthesaurus 10:20:47 workflow.py:2103 DEBUG ---------- finished in 0.287s ---------- [10:20:47.270] Powerthesaurus[Script Filter] <?xml version="1.0" encoding="utf-8"?>

Error in workflow 'Powerthesaurus'<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)>/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns`
tjisousa commented 4 years ago

The SSL certificate of the API endpoint used by the workflow has expired.

A quick solution is to "monkey patch" the web.py file in your workflow with the following lines:

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

I have tested and is working. However, I don't recommend since this is extremely unsafe as it bypasses the verification. But if you really need to use the workflow, this is a solution.

image

Nurou commented 4 years ago

Experiencing the same issue. Hope this gets fixed soon

ocundale commented 4 years ago

Also experiencing this. One of my favourite workflows, really hope a fix is found!

lightlii commented 4 years ago

Same here, use it a lot and now it's dead. Seems like them problem might be on the side of powerthesaurus though...

clarencecastillo commented 4 years ago

The current extraction method does some HTML scraping to collect the results since Powerthesaurus used to do server-side rendering to deliver search results. Now it seems they've changed it to RESTful API calls which is somewhat easier to work with, just that I'll be working blind given I do not officially work with them and do not have access to the official documentation. Working on the fix at the moment, will do some tests and get a new release out.

clarencecastillo commented 4 years ago

Fix is up and I've shifted the extraction method away from scraping classicthesaurus.org to a cleaner method by using their API.

Sorry it took awhile! Please give the new release a try and let me know if you're still having issues.

Nurou commented 4 years ago

Works like a charm. Thanks!

ocundale commented 4 years ago

Legend! All working again

Do you have a Bitcoin address where I can send you a tip?

lightlii commented 4 years ago

Thanks for this, unfortunately I have a 'workflow incompatible' message. Does this version uses features that require alfred 4? If so I guess it's time to upgrade...

clarencecastillo commented 4 years ago

@ocundale Appreciate it mate! I don't have one but in any case, please send your donation directly to the team working on Power Thesaurus. They could use all the help to cover their operational costs 🍻

clarencecastillo commented 4 years ago

Does this version uses features that require alfred 4?

I exported the workflow from Alfred 4 which makes it compatible only with Alfred 4+. Unfortunately, I do not use Alfred 3 anymore so I won't be able to maintain supporting that version in parallel.

Technically, the workflow doesn't really use any Alfred 4 specific features, so it's still possible to have it ported to Alfred 3. If you're interested, I can walk you through the steps on how you can do it. Feel free to create a new issue about it and we'll work it out from there.

rooted-admin commented 4 years ago

this issue seems to have come back. anyone else experiencing?

ocundale commented 4 years ago

Yes, I am also experiencing this issue again :/

rooted-admin commented 4 years ago

just noticed Clarence pushed a change to disable verification: https://github.com/clarencecastillo/alfred-powerthesaurus/commit/84c15477b723e3ca9398f96e647d52d0556a5969