Bump version to 0.1.1 in pyproject.toml & add GLS tracker

- Increase version to 0.1.1 in pyproject.toml to show updated version
- Add "glsapi" as a new dependency in pyproject.toml for package
- Add GLS tracker module
- Create GLS class and methods to get status and supported carriers
This commit is contained in:
Kumi 2023-08-25 07:54:34 +02:00
parent e4478d4a42
commit ecde311927
Signed by: kumi
GPG key ID: ECBCC9082395383F
2 changed files with 36 additions and 1 deletions

View file

@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "trackbert"
version = "0.1.0"
version = "0.1.1"
authors = [
{ name="Kumi Mitterer", email="trackbert@kumi.email" },
]
@ -20,6 +20,7 @@ classifiers = [
dependencies = [
"pykeydelivery",
"postat",
"glsapi",
"sqlalchemy",
"python-dateutil",
]

View file

@ -0,0 +1,34 @@
from .base import BaseTracker
from ..classes.database import Event
import json
from dateutil.parser import parse
from glsapi.classes.api import GLSAPI
class GLS(BaseTracker):
def __init__(self, *args, **kwargs):
pass
def get_status(self, tracking_number, carrier):
api = GLSAPI()
status = api.tracking(tracking_number)
events = status["tuStatus"][0]["history"]
for event in events:
event_time = f"{event['date']} {event['time']}"
yield Event(
shipment_id=0,
event_time=event_time,
event_description=event["evtDscr"],
raw_event=json.dumps(event),
)
def supported_carriers(self):
return [
("gls", 100),
]
tracker = GLS