Spaces:
Paused
Paused
update api weather
Browse files- weather.py +8 -2
weather.py
CHANGED
@@ -3,9 +3,15 @@ import json
|
|
3 |
import datetime
|
4 |
from pprint import pprint
|
5 |
from datetime import date
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
def get_weather(city, date):
|
7 |
-
agro_api_key = "
|
8 |
-
opencage_api_key = "
|
9 |
|
10 |
# On récupère les lat et lon de la ville
|
11 |
geocode_url = f"https://api.opencagedata.com/geocode/v1/json?q={city}&key={opencage_api_key}"
|
|
|
3 |
import datetime
|
4 |
from pprint import pprint
|
5 |
from datetime import date
|
6 |
+
from dotenv import load_dotenv
|
7 |
+
import os
|
8 |
+
|
9 |
+
load_dotenv()
|
10 |
+
|
11 |
+
|
12 |
def get_weather(city, date):
|
13 |
+
agro_api_key = os.getenv("AGRO_API_KEY")
|
14 |
+
opencage_api_key = os.getenv("OPENCAGE_API_KEY")
|
15 |
|
16 |
# On récupère les lat et lon de la ville
|
17 |
geocode_url = f"https://api.opencagedata.com/geocode/v1/json?q={city}&key={opencage_api_key}"
|