Backup automatico script del 2026-01-25 07:00
This commit is contained in:
@@ -14,6 +14,7 @@ import requests
|
||||
import time
|
||||
from logging.handlers import RotatingFileHandler
|
||||
from typing import Dict, List, Tuple, Optional
|
||||
from open_meteo_client import open_meteo_get
|
||||
|
||||
# Setup logging
|
||||
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
@@ -361,7 +362,7 @@ def get_coordinates_from_city(city_name: str) -> Optional[Tuple[float, float, st
|
||||
url = "https://geocoding-api.open-meteo.com/v1/search"
|
||||
params = {"name": city_name, "count": 1, "language": "it"}
|
||||
try:
|
||||
resp = requests.get(url, params=params, timeout=5)
|
||||
resp = open_meteo_get(url, params=params, timeout=(5, 10))
|
||||
if resp.status_code == 200:
|
||||
data = resp.json()
|
||||
if data.get("results"):
|
||||
@@ -449,7 +450,7 @@ def get_weather_data(lat: float, lon: float, model_slug: str) -> Optional[Dict]:
|
||||
}
|
||||
|
||||
try:
|
||||
resp = requests.get(url, params=params, timeout=10)
|
||||
resp = open_meteo_get(url, params=params, timeout=(5, 10))
|
||||
if resp.status_code == 200:
|
||||
data = resp.json()
|
||||
# Verifica che snowfall sia presente nei dati
|
||||
|
||||
Reference in New Issue
Block a user