No description
Find a file
Kumi 9374b1284e
Update loop_interval in Tracker class and handle timeout while processing shipments
- Update loop_interval to 60 seconds
- Add loop_timeout to Tracker class with a value of 30 seconds
- Wrap process_shipment calls in asyncio.wait_for with timeout set to loop_timeout value
- Add try-except block to handle TimeoutError and log a warning message
- Code changes aim to improve the handling of long-running shipments processing with a timeout mechanism in place
2023-08-24 17:34:18 +02:00
assets feat: Add desktop notification functionality with icon 2023-08-21 09:14:25 +02:00
classes Update loop_interval in Tracker class and handle timeout while processing shipments 2023-08-24 17:34:18 +02:00
trackers Refactor shipment_id assignment in Tracker and trackers/keydelivery.py 2023-08-24 15:33:09 +02:00
.gitignore Current status 2023-08-17 12:50:49 +02:00
config.dist.ini Add new files and update existing files with configuration details. 2023-08-18 09:59:40 +02:00
LICENSE Add new files and update existing files with configuration details. 2023-08-18 09:59:40 +02:00
README.md Add new files and update existing files with configuration details. 2023-08-18 09:59:40 +02:00
requirements.txt feat: Add write_event method to Database class 2023-08-24 14:46:54 +02:00
trackbert.py feat: Add asynchronous support for tracking shipments 2023-08-24 17:27:43 +02:00

Trackbert

A simple Python script for tracking shipments 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.

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

git clone https://kumig.it/kumitterer/trackbert.git
cd trackbert
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Then copy config.dist.ini to config.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.

Usage

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

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

License

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