Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,16 +10,10 @@ import os
|
|
| 10 |
# Access the API key from the secret
|
| 11 |
API_KEY = os.getenv("apikey")
|
| 12 |
|
| 13 |
-
# Check if the API key is loaded correctly (optional)
|
| 14 |
-
if api_key:
|
| 15 |
-
print("API key loaded successfully!")
|
| 16 |
-
else:
|
| 17 |
-
print("API key not found!")
|
| 18 |
-
|
| 19 |
API_URL = f"https://v6.exchangerate-api.com/v6/{API_KEY}/latest/USD"
|
| 20 |
CACHE = None
|
| 21 |
LAST_FETCH_TIME = None
|
| 22 |
-
CACHE_TTL =
|
| 23 |
|
| 24 |
def fetch_exchange_rates():
|
| 25 |
"""Fetch the exchange rates from the API."""
|
|
|
|
| 10 |
# Access the API key from the secret
|
| 11 |
API_KEY = os.getenv("apikey")
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
API_URL = f"https://v6.exchangerate-api.com/v6/{API_KEY}/latest/USD"
|
| 14 |
CACHE = None
|
| 15 |
LAST_FETCH_TIME = None
|
| 16 |
+
CACHE_TTL = 86400 # Time to live for cache in seconds (1 day)
|
| 17 |
|
| 18 |
def fetch_exchange_rates():
|
| 19 |
"""Fetch the exchange rates from the API."""
|