helper-scripts/getweather.py

18 lines
361 B
Python
Raw Permalink Normal View History

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