Navigation Menu

Skip to content

Commit

Permalink
Update and rename weatherforecast.py to current_weather.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss committed May 30, 2020
1 parent c097dc7 commit eefe965
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 36 deletions.
19 changes: 19 additions & 0 deletions web_programming/current_weather.py
@@ -0,0 +1,19 @@
from pprint import pprint

import requests

APPID = "" # <-- Put your OpenWeatherMap appid here!
URL_BASE = "http://api.openweathermap.org/data/2.5/weather"


def current_weather(location: str = "Chicago", appid: str = APPID) -> dict:
return requests.get(URL_BASE, params={"appid": appid, "q": location}).json()


if __name__ == "__main__":
while True:
location = input("Enter a location:").strip()
if location:
pprint(current_weather(location))
else:
break
36 changes: 0 additions & 36 deletions web_programming/weatherforecast.py

This file was deleted.

0 comments on commit eefe965

Please sign in to comment.