helper-scripts/getweather.py

17 lines
334 B
Python
Raw Normal View History

2019-01-20 14:16:52 -08:00
#!/usr/bin/python3
"""Obtain a weather forecast."""
import argparse
import requests
WTTR_URI = 'http://wttr.in'
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('location')
args = parser.parse_args()
location = args.location
print(requests.get(f"{WTTR_URI}/{location}").text)