Make carrier_code optional in TrackingMore.track_shipment()

This commit is contained in:
Kumi 2023-05-03 13:50:28 +00:00
parent 96140ebd31
commit b68b7c438e
Signed by: kumi
GPG key ID: ECBCC9082395383F
2 changed files with 2 additions and 2 deletions

View file

@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project] [project]
name = "trackingmore" name = "trackingmore"
version = "0.1.1" version = "0.1.2"
authors = [ authors = [
{ name="Kumi Mitterer", email="trackingmore-api-tool@kumi.email" }, { name="Kumi Mitterer", email="trackingmore-api-tool@kumi.email" },
] ]

View file

@ -38,7 +38,7 @@ class TrackingMore:
def detect_carrier(self, tracking_number: str): def detect_carrier(self, tracking_number: str):
return self.request("detect", {"tracking_number": tracking_number}).get("data", {}) return self.request("detect", {"tracking_number": tracking_number}).get("data", {})
def track_shipment(self, tracking_number: str, carrier_code: str): def track_shipment(self, tracking_number: str, carrier_code: Optional[str] = None):
payload = { payload = {
"tracking_number": tracking_number, "tracking_number": tracking_number,
"courier_code": carrier_code or self.detect_carrier(tracking_number)[0]["courier_code"] "courier_code": carrier_code or self.detect_carrier(tracking_number)[0]["courier_code"]