Introduce support for the 4PX tracking provider by integrating
the track4px library. Added the necessary dependencies and
implemented the FourPX class to fetch and yield tracking status
events, enhancing our logistics tracking capabilities.
Added get-contents.py and output directory to the .gitignore to prevent unnecessary files from being tracked. This helps in maintaining a cleaner repository by keeping only relevant files.
Introduced methods to add and remove shipments in the Core class
and enhanced the notifier system with handlers for various shipment
events. This improvement facilitates better shipment tracking and
notification capabilities, allowing dynamic shipment management
through the notifier interface. Minor code cleanup in `__main__.py`.
Refactored the handling of entry points for notifiers and providers
to avoid potential errors when their groups are missing. Simplifies
and improves the robustness of the logic by directly iterating over
all entry points and filtering by group instead of relying on
potentially absent group keys.
Updated constructors in BaseNotifier, Matrix, and NotifySend classes
to consistently use kwargs for initialization. Simplifies the
BaseNotifier class and reduces the need for extra positional
arguments in derived classes, leading to clearer and more flexible
instantiation.
Enhanced readability and consistency by reformatting `pyproject.toml` and other Python files. Removed unnecessary imports and ensured consistent styling across the codebase. These changes boost maintainability and reduce potential errors.
Improved the Matrix notifier's message delivery by converting data payloads to JSON format before sending. This change includes encoding the message data as UTF-8 and setting the appropriate `Content-Type` header in the request. This adjustment ensures better compatibility with the Matrix API and potentially reduces issues related to content formatting and data interpretation on the receiving end.
Refactored import statements for clarity and consistency within the module.
Replaced the usage of setuptools.metadata with importlib.metadata to handle package metadata operations. This change aligns with modern Python practices, offering a more standardized and potentially more efficient way of accessing package metadata. The shift also reduces the dependency on the external setuptools package, which can simplify deployment and reduce potential conflicts.
Introduced a new notifier for Matrix to allow messages to be sent to specified rooms on a Matrix server. This extends the application's notification system, enabling it to interact with Matrix homeservers using room IDs and access tokens defined in the configuration. The added `Matrix` class supports basic notification functionality, including determining if the notifier is enabled and sending messages. This enhancement caters to users within the Matrix ecosystem, providing a more integrated experience for alert and notification management.
Added functionality to dynamically discover and load external notifiers and providers through entry points. This enhancement allows for modular extension of the system's capabilities by enabling third-party plugins to register notifiers and tracking providers. By utilizing the `importlib.metadata.entry_points`, the system now searches for any registered plugins under the `trackbert.notifiers` and `trackbert.providers` namespaces, loads them, and if valid, incorporates them into the available notifiers and providers list. This brings improved extensibility and customization possibilities, catering to a wider range of use cases and third-party integrations.
- Introduced support and PyPI version badges in README to enhance visibility and provide quick access to the package version and support options.
- Updated URLs in both README and pyproject.toml, shifting the project's homepage, bug tracker, and source code references to the new git.private.coffee platform. This move supports a more centralized and private management of the project infrastructure.
The inclusion of badges in the README not only improves the aesthetic appeal but also offers essential information at a glance, encouraging user engagement. Transitioning to private.coffee for project URLs signifies a strategic choice towards a more controlled and secure environment for development and community interaction.
Previously, the `notify_event` method had a parameter named `critical` to determine the urgency of the notification. This has been changed to `urgent` for clarity. The method now uses the `urgent` parameter directly in the `self.notify` call instead of converting it to an "urgency" string. This commit refactors the code to improve readability and maintainability.
Previously, an API call was made to get the shipment status using the tracking number. The code now incorporates exception handling to log any errors that occur during the fetching of the status. This change ensures that any potential errors are captured and logged for debugging purposes.
The current code adds handling for existing shipments and improves the update functionality in the `__main__.py` file. The changes include checking if a shipment already exists, updating the shipment with the specified carrier, and printing appropriate messages.
- Create shipment if it doesn't exist, when the shipment and update flag are both not set.
- Print an error message and exit with error code if the "How did you get here?" case is reached.
- 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 refactors the carrier selection logic in the `main` function in `__main__.py`. The code now uses the variable name `provider` instead of `api` for clarity. Additionally, the logic for filtering providers is updated to correctly check for other providers with a higher priority for a given carrier.
Previously, the code used the variable name `apis` to represent the available tracking APIs. This has been changed to `providers` for improved semantic understanding. The condition for selecting carriers has also been updated to use the new variable name, enhancing code comprehension.
The Core class in core.py has been refactored to include a new method find_external_notifiers() which is currently returning an empty list, and find_external_providers() which is also returning an empty list. Both methods are placeholders for future implementation using entry points. The find_notifiers() and find_providers() methods have been updated to include the results of the new methods.
Previously, when loading notifier classes in the Core class, any error that occurred would simply log an error message without providing any details. This commit improves error handling by catching exceptions and logging the specific error message when loading a notifier class fails. This allows for better debugging and troubleshooting in the future.
This commit adds a new column named "disabled" to the Shipment table in the database, allowing shipments to be disabled. The default value for this column is false. As part of this change, a new migration script has been added to update the database schema. Additionally, when retrieving shipments in the Database class, the get_shipments method now has an optional ignore_disabled parameter, which filters out disabled shipments if set to True. In the Tracker class, a database timeout handling has been added, and the database connection is disposed upon encountering a timeout.
The previous code did not handle errors while processing shipments, which could lead to unexpected behavior. This commit adds error handling to the shipment processing loops to log and handle various types of exceptions. Now, exceptions such as database timeouts and keyboard interrupts are caught and logged appropriately.
- Update pykeydelivery dependency to version >= 0.9.1 in pyproject.toml
- Refactor the supported_carriers method in keydelivery.py to use self.api.list_carriers() instead of making an HTTPRequest to "https://app.kd100.com/console/utils/kdbm"
- Change version in pyproject.toml to 0.2.2
- Add DHL tracking provider to README.md
- Update README.md with instructions for generating a config file
- Improve config file generation in __main__.py
- Load config file in Tracker class
- Update start and start_async methods in Tracker class to accept an optional config file path
This commit adds the DHL configuration and implementation to the project.
- Added DHL configuration to the config file.
- Updated the project version to 0.2.1 in the pyproject.toml file.
- Created a new file for the DHL tracker implementation.
- Implemented the DHL tracker functionality to get shipment events.
- Added DHL to the list of supported carriers.
The commit also includes changes to add Alembic configuration file, add migration scripts for initial migration, and modify the database class to include functions for running migrations and creating new migrations.
- Add FedEx configuration to config.ini
- Add FedEx tracking module to dependencies
- Implement FedEx tracking functionality
- Add FedEx as a supported carrier in the tracker
- Add GLS to list of tracking providers
- Update installation instructions to include creating `config.ini` file with KeyDelivery API details
- Mention that without creating `config.ini` file, only tracking shipments from Austrian Post and GLS is possible.
- Increase version to 0.1.1 in pyproject.toml to show updated version
- Add "glsapi" as a new dependency in pyproject.toml for package
- Add GLS tracker module
- Create GLS class and methods to get status and supported carriers
- 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