From 357baf0b5737d809cfcdce408c6f66e9738b92d5 Mon Sep 17 00:00:00 2001 From: Marius Alwan Meyer Date: Fri, 29 Sep 2023 13:06:41 +0200 Subject: [PATCH] Treat api key like a password and get it earlier --- openweather.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openweather.py b/openweather.py index 51cb783..a6eb108 100755 --- a/openweather.py +++ b/openweather.py @@ -6,8 +6,8 @@ from rich.panel import Panel from rich.prompt import Prompt from rich.columns import Columns +api_key = Prompt.ask("Enter your Api Key", password=True) city_name = Prompt.ask("Enter your City", default="Göttingen") -api_key = Prompt.ask("Enter your Api Key") base_url = "https://api.openweathermap.org/data/2.5/weather?" complete_url = base_url + "appid=" + api_key + "&q=" + city_name @@ -34,7 +34,7 @@ if x["cod"] != "404": Panel(f"[blue]{current_humidity}%", title="[bold]Humidity[/bold]"), - + Panel(f"[blue]{weather_description}", title="[bold]Description[/bold]"), ]))