Zoro-147 commited on
Commit
7c5b5fd
·
verified ·
1 Parent(s): d507388

Delete weather.py

Browse files
Files changed (1) hide show
  1. weather.py +0 -24
weather.py DELETED
@@ -1,24 +0,0 @@
1
- import requests
2
- import os
3
-
4
- WEATHER_API_KEY = os.getenv("WEATHER_API_KEY")
5
-
6
- def get_current_weather(location: str) -> str:
7
- url = "https://weatherapi-com.p.rapidapi.com/current.json?q=53.1%2C-0.13"
8
- params = {
9
- "key": WEATHER_API_KEY,
10
- "q": location,
11
- }
12
- try:
13
- response = requests.get(url, params=params, timeout=10)
14
- response.raise_for_status()
15
- data = response.json()
16
- location = data["location"]["name"]
17
- temp_c = data["current"]["temp_c"]
18
- condition = data["current"]["condition"]["text"]
19
- humidity = data["current"]["humidity"]
20
- wind_kph = data["current"]["wind_kph"]
21
- return (f"Weather in {location}: {temp_c}°C, {condition}, "
22
- f"Humidity: {humidity}%, Wind: {wind_kph} km/h")
23
- except Exception as e:
24
- return f"Error fetching weather: {str(e)}"