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