Make carrier_code optional in TrackingMore.track_shipment()
This commit is contained in:
parent
96140ebd31
commit
b68b7c438e
2 changed files with 2 additions and 2 deletions
|
@ -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" },
|
||||||
]
|
]
|
||||||
|
|
|
@ -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"]
|
||||||
|
|
Loading…
Reference in a new issue