Spaces:
Sleeping
Sleeping
update open weather api key
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel,load_tool, tool
|
|
|
2 |
import datetime
|
3 |
import requests
|
4 |
import pytz
|
@@ -15,10 +16,11 @@ def get_weather(location:str,)-> dict: #it's import to specify the return type
|
|
15 |
Args:
|
16 |
location: A string representing location (Eg. London)
|
17 |
"""
|
|
|
18 |
base_url = "https://api.openweathermap.org/data/2.5/weather"
|
19 |
params = {
|
20 |
"q": location,
|
21 |
-
"appid":
|
22 |
"units": "metric" # Get temperature in Celsius
|
23 |
}
|
24 |
response = requests.get(base_url, params=params)
|
|
|
1 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel,load_tool, tool
|
2 |
+
import os
|
3 |
import datetime
|
4 |
import requests
|
5 |
import pytz
|
|
|
16 |
Args:
|
17 |
location: A string representing location (Eg. London)
|
18 |
"""
|
19 |
+
api_key = os.getenv("openweatherapikey")
|
20 |
base_url = "https://api.openweathermap.org/data/2.5/weather"
|
21 |
params = {
|
22 |
"q": location,
|
23 |
+
"appid": api_key,
|
24 |
"units": "metric" # Get temperature in Celsius
|
25 |
}
|
26 |
response = requests.get(base_url, params=params)
|