From d09a459629b8b46673e1b609fbd1d26cc8a628f2 Mon Sep 17 00:00:00 2001 From: Nischay mrzn <129774293+Nischaymrzn@users.noreply.github.com> Date: Mon, 28 Oct 2024 12:06:45 +0545 Subject: [PATCH] Create get_weather.py --- Python/get_weather.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Python/get_weather.py diff --git a/Python/get_weather.py b/Python/get_weather.py new file mode 100644 index 0000000..5b52ef7 --- /dev/null +++ b/Python/get_weather.py @@ -0,0 +1,6 @@ +import requests +def get_weather(city): + api_key = "YOUR_API_KEY" + url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}" + response = requests.get(url) + return response.json()