Created
January 26, 2022 03:05
-
-
Save AshyIsMe/6676f392326bc6aef4a3a06287d95e5d to your computer and use it in GitHub Desktop.
Single line of weather from wttr.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from urllib.parse import quote | |
import subprocess | |
def wttr(location): | |
c = "curl wttr.in/" + quote(location) + '?0TQ' | |
r = subprocess.run(c, shell=True, stdout=subprocess.PIPE) | |
l = r.stdout.decode('utf-8').split('\n') | |
w = ' '.join([s[16:].strip() for s in l]) | |
return w + '$ ' + c | |
def main(): | |
print( wttr('brisbane') ) | |
if __name__=="__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sopel module
I think it might be this simple. Untested currently
sopel-wttr.py