Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,10 +16,10 @@ def get_weather(city: str)-> str: #it's import to specify the return type
|
|
| 16 |
"""
|
| 17 |
try:
|
| 18 |
api_url = f"https://api.weather.com/v1/location/{city}"
|
| 19 |
-
|
| 20 |
"Authorization" : "Bearer fc5de4ef7812c4aa77860ca1874f8ef9"
|
| 21 |
}
|
| 22 |
-
response = requests.get(api_url,
|
| 23 |
if response.status_code ==200:
|
| 24 |
data = response.json()
|
| 25 |
weather_info = data.get("weather", "No weather information available")
|
|
|
|
| 16 |
"""
|
| 17 |
try:
|
| 18 |
api_url = f"https://api.weather.com/v1/location/{city}"
|
| 19 |
+
headers = {
|
| 20 |
"Authorization" : "Bearer fc5de4ef7812c4aa77860ca1874f8ef9"
|
| 21 |
}
|
| 22 |
+
response = requests.get(api_url, headers = headers, timeout = 10)
|
| 23 |
if response.status_code ==200:
|
| 24 |
data = response.json()
|
| 25 |
weather_info = data.get("weather", "No weather information available")
|