giovanni Posted March 23, 2022 Share Posted March 23, 2022 - Launch `alfred-almanac` to retrieve weather and other almanac information from default locations ... - ... or enter a location/ZIP code directly - The default weather string from wttr.in will output: - `%C` weather condition text - `%c` weather condition - 🌡️`%t` actual temperature - `%f` 'feels like' temperature - `%h` humidity - 🌬️`%w` wind - `%m` moon phase - The almanac section will output: - local date and time - Current week of the year - current quarter - days from and to the end of the year - days from and to the special day - Enter (↩️) will copy to the clipboard and past to the frontmost application - Shift-enter (⇧↩️) will open the corresponding page on wttr.in - CTRL-enter (⌃↩️) will show the almanac string in large font Feedback and suggestions for improvement are welcome! https://github.com/giovannicoppola/alfred-almanac Link to comment
edbro Posted March 23, 2022 Share Posted March 23, 2022 I can't get this to work. I installed it, set my location and installed Python 3.10.3. When I try to execute the shortcut it says "one moment while I retrieve..." and then it goes blank and returns nothing. I also tried feeding a zip code after the !w but got the same negative result. Link to comment
giovanni Posted March 23, 2022 Author Share Posted March 23, 2022 sorry to hear that! could you copy here what the debugger is saying? Also, you only need one between ZIP code and location, and no state, so 76051 should be sufficient Link to comment
edbro Posted March 23, 2022 Share Posted March 23, 2022 [16:25:31.991] Logging Started... [16:25:39.631] alfred almanac[Script Filter] Queuing argument '(null)' [16:25:40.461] alfred almanac[Script Filter] Script with argv '(null)' finished [16:25:40.465] ERROR: alfred almanac[Script Filter] Code 1: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1348, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1282, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1328, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1277, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1037, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 975, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1454, in connect self.sock = self._context.wrap_socket(self.sock, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 512, in wrap_socket return self.sslsocket_class._create( File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1070, in _create self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1341, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/eds/Library/CloudStorage/OneDrive-Personal/Alfred Preferences/Alfred.alfredpreferences/workflows/user.workflow.2F82C213-7F09-47F3-AC73-F785D9A2F293/almanac.py", line 129, in <module> myOutput,myLocalTime= get_weather(loc) File "/Users/eds/Library/CloudStorage/OneDrive-Personal/Alfred Preferences/Alfred.alfredpreferences/workflows/user.workflow.2F82C213-7F09-47F3-AC73-F785D9A2F293/almanac.py", line 42, in get_weather with urllib.request.urlopen(myURL) as response: File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 216, in urlopen return opener.open(url, data, timeout) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 525, in open response = meth(req, response) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 634, in http_response response = self.parent.error( File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 557, in error result = self._call_chain(*args) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 496, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 749, in http_error_302 return self.parent.open(new, timeout=req.timeout) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 519, in open response = self._open(req, data) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 536, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 496, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1391, in https_open return self.do_open(http.client.HTTPSConnection, req, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1351, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)> [16:25:31.991] Logging Started... [16:25:39.631] alfred almanac[Script Filter] Queuing argument '(null)' [16:25:40.461] alfred almanac[Script Filter] Script with argv '(null)' finished [16:25:40.465] ERROR: alfred almanac[Script Filter] Code 1: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1348, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1282, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1328, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1277, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1037, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 975, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1454, in connect self.sock = self._context.wrap_socket(self.sock, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 512, in wrap_socket return self.sslsocket_class._create( File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1070, in _create self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1341, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/eds/Library/CloudStorage/OneDrive-Personal/Alfred Preferences/Alfred.alfredpreferences/workflows/user.workflow.2F82C213-7F09-47F3-AC73-F785D9A2F293/almanac.py", line 129, in <module> myOutput,myLocalTime= get_weather(loc) File "/Users/eds/Library/CloudStorage/OneDrive-Personal/Alfred Preferences/Alfred.alfredpreferences/workflows/user.workflow.2F82C213-7F09-47F3-AC73-F785D9A2F293/almanac.py", line 42, in get_weather with urllib.request.urlopen(myURL) as response: File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 216, in urlopen return opener.open(url, data, timeout) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 525, in open response = meth(req, response) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 634, in http_response response = self.parent.error( File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 557, in error result = self._call_chain(*args) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 496, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 749, in http_error_302 return self.parent.open(new, timeout=req.timeout) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 519, in open response = self._open(req, data) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 536, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 496, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1391, in https_open return self.do_open(http.client.HTTPSConnection, req, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1351, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)> Link to comment
giovanni Posted March 23, 2022 Author Share Posted March 23, 2022 I am wondering if it is Python 3.10? I have tested 3.8.9. Link to comment
giovanni Posted March 23, 2022 Author Share Posted March 23, 2022 also @edbro, does this work? https://wttr.in/76051 Link to comment
edbro Posted March 23, 2022 Share Posted March 23, 2022 6 minutes ago, giovanni said: also @edbro, does this work? Yes Link to comment
giovanni Posted March 24, 2022 Author Share Posted March 24, 2022 @edbro could you try this version which is using a different package? I tested this and the main one on 3.9.5 and they both work for me. thanks! Link to comment
sepulchra Posted March 25, 2023 Share Posted March 25, 2023 (edited) @giovanni thanks for making this workflow .... would you consider a feature request? the workflow below was really a lovely workflow but it is no longer being active developed and has run into issues with the weather services it leveraged. Would you consider adding the option of pulling more data from wttr.in? It looks like you might be able to pull 3 days out and not quite hourly data but a forecast for 4 times a day? EDITED: after looking at github, i'm guessing you are using the one-line output, so i'm guessing all of those parameters are not possible. Edited March 25, 2023 by sepulchra Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now