Treat api key like a password and get it earlier

This commit is contained in:
Marius Alwan Meyer 2023-09-29 13:06:41 +02:00
parent 03f0f541d4
commit 357baf0b57

View File

@ -6,8 +6,8 @@ from rich.panel import Panel
from rich.prompt import Prompt from rich.prompt import Prompt
from rich.columns import Columns 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") 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?" base_url = "https://api.openweathermap.org/data/2.5/weather?"
complete_url = base_url + "appid=" + api_key + "&q=" + city_name complete_url = base_url + "appid=" + api_key + "&q=" + city_name
@ -34,7 +34,7 @@ if x["cod"] != "404":
Panel(f"[blue]{current_humidity}%", Panel(f"[blue]{current_humidity}%",
title="[bold]Humidity[/bold]"), title="[bold]Humidity[/bold]"),
Panel(f"[blue]{weather_description}", Panel(f"[blue]{weather_description}",
title="[bold]Description[/bold]"), title="[bold]Description[/bold]"),
])) ]))