Update shipment with carrier for a given tracking number

- Added a check to print a message if the shipment does not exist and the update flag is set
- Added an error message for cases where a shipment cannot be created because it does not exist
This commit is contained in:
Kumi 2023-09-12 08:20:15 +02:00
parent dafce82106
commit e9c7ed12d3
Signed by: kumi
GPG key ID: ECBCC9082395383F
2 changed files with 6 additions and 1 deletions

View file

@ -140,6 +140,11 @@ def main():
print(
f"Updated shipment for {args.tracking_number} with carrier {args.carrier}"
)
if shipment is None and args.update:
print(f"Shipment {args.tracking_number} does not exist. Remove -u to create.")
exit(1)
else:
tracker.db.create_shipment(
args.tracking_number, args.carrier, args.description

View file

@ -12,4 +12,4 @@ secret = api_secret
[DHL]
key = api_key
secret = api_secret
ratelimited = 1
ratelimited = 1