18 lines
361 B
Python
Executable File
18 lines
361 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""Obtain a weather forecast."""
|
|
|
|
import argparse
|
|
import requests
|
|
|
|
# ========== Constants ==========
|
|
WTTR_URI = "http://wttr.in"
|
|
|
|
# ========== Main Script ==========
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("location")
|
|
|
|
args = parser.parse_args()
|
|
location = args.location
|
|
|
|
print(requests.get(f"{WTTR_URI}/{location}").text)
|