lathashree01 commited on
Commit
a28130e
·
verified ·
1 Parent(s): 2199539

update open weather api key

Browse files
Files changed (1) hide show
  1. app.py +3 -1
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": self.api_key,
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)