Skip to main content

Python application tracking your shipments

Project description

Trackbert

A simple Python script for tracking shipments, primarily through KeyDelivery.

If your system provides notify-send, you will get a desktop notification when the status of your shipment changes.

Status information is stored in a SQLite database.

Currently supported tracking providers

More tracking providers can be added easily by subclassing trackbert.trackers.base.BaseTracker. This should be relatively self-explanatory if you look at the existing implementations. Pull requests are welcome!

Requirements

The script was developed and tested on Arch Linux using Python 3.11. The "Never" type hint is used, so I suppose it will not work on older Python versions. It should work on any Linux distribution. You can technically run it on Windows and macOS as well, but you will not get desktop notifications.

In order to get desktop notifications, you need to have notify-send installed. On Arch Linux, this is provided by the libnotify package. If your desktop environment does not provide a notification server, you have to install one yourself. How to do this is beyond the scope of this README.

Installation

First, create a virtual environment and install the package:

python -m venv venv
source venv/bin/activate
pip install trackbert

Then create a config.ini in your working directory (see config.dist.ini) and fill in your KeyDelivery API details, which you can find in your KeyDelivery API management. You can find your API key in your KeyDelivery account settings.

You can also omit this step, but then you will only be able to track shipments from Austrian Post and GLS.

Usage

First, assure that the virtual environment is activated:

source venv/bin/activate

If you need to create a new config file, run trackbert -g. You need this if you want to provide API keys required for KeyDelivery or some of the other tracking providers.

To add a new shipment, run trackbert --tracking-number <tracking-number> --carrier <carrier-id>. Find the required carrier ID in the KeyDelivery API management.

To run the main loop, run trackbert. This will check the status of all shipments every minute, and print the status to the console. If the status of a shipment changes, you will get a desktop notification.

Caveats

DHL

By default, the script queries for updates for each active shipment once per minute. However, if you have the DHL API enabled, you will quickly run into the rate limit. Therefore, the script will only query for updates once per hour (if minute == 0). For the default 250 requests per day limit, this means that you can only track up to 10 shipments simultaneously.

You may request a higher rate limit from DHL. See the DHL Developer Portal for details. If you do this, you can set ratelimited = 0 (note that 0/1 is a boolean value in the config file) in your config.ini to disable the rate limit.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trackbert-0.2.3.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

trackbert-0.2.3-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file trackbert-0.2.3.tar.gz.

File metadata

  • Download URL: trackbert-0.2.3.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for trackbert-0.2.3.tar.gz
Algorithm Hash digest
SHA256 3971173ca004744354de140ae0e6e4e0e3c211dfd81a9944acba389966e913a3
MD5 a3a9df4557b7b1c399a936f267a4c3b5
BLAKE2b-256 1d566c78b440e2ffca980f30134399909ee3a87742a062db808f5a97e2792c97

See more details on using hashes here.

File details

Details for the file trackbert-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: trackbert-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for trackbert-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8fafd2f3da2e0fcc505ab5d9196d258d4bb8b2dc0d92368b11971c13c27d70ea
MD5 f2de28c1b1b465e48edab6666887cf3a
BLAKE2b-256 284feebe430baf7935c9ac1b499176a8be5947f3ba23d32aaa8c5d7ecc1c9f98

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page