Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tesi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marco Aceti
Tesi
Commits
80c8eb5b
Verified
Commit
80c8eb5b
authored
Mar 28, 2023
by
Marco Aceti
Browse files
Options
Downloads
Patches
Plain Diff
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
Mar 28, 2023
Stage: test
Stage: lint
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/const.py
+2
-1
2 additions, 1 deletion
src/const.py
src/scraper/api.py
+2
-2
2 additions, 2 deletions
src/scraper/api.py
with
4 additions
and
3 deletions
src/const.py
+
2
−
1
View file @
80c8eb5b
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
This diff is collapsed.
Click to expand it.
src/scraper/api.py
+
2
−
2
View file @
80c8eb5b
...
...
@@ -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
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment