Skip to content
Snippets Groups Projects
Verified Commit 80c8eb5b authored by Marco Aceti's avatar Marco Aceti
Browse files

Fix global timezone

Use Europe/Rome instead of 'GMT+1'.
parent 62403976
No related branches found
No related tags found
No related merge requests found
Pipeline #2763 passed
from dateutil import tz
# Global timezone used in all datetime calls.
TIMEZONE = tz.gettz("GMT+1")
TIMEZONE = tz.gettz("Europe/Rome")
TIMEZONE_GMT = tz.gettz("GMT")
# Intra-day split hour
INTRADAY_SPLIT_HOUR: int = 4
......@@ -7,7 +7,7 @@ from requests.adapters import HTTPAdapter, Retry
import src.scraper.train as tr
from src import types
from src.const import TIMEZONE
from src.const import TIMEZONE, TIMEZONE_GMT
from src.scraper.exceptions import BadRequestException
......@@ -101,7 +101,7 @@ class ViaggiaTrenoAPI:
"""
assert kind in ["partenze", "arrivi"]
now: str = datetime.now(tz=TIMEZONE).strftime("%a %b %d %Y %H:%M:%S %Z%z")
now: str = datetime.now(tz=TIMEZONE_GMT).strftime("%a %b %d %Y %H:%M:%S %Z%z")
raw_trains: str = ViaggiaTrenoAPI._raw_request(kind, station_code, now)
trains: types.JSONType = ViaggiaTrenoAPI._decode_json(raw_trains)
return list(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment