tap-dhl-ecommerce
is a Singer tap for DHL eCommerce Americas.
Built with the Meltano Tap SDK for Singer Taps.
- Leverages the
tracking
endpoint from the DHL eCommerce Americas API in order to grab package tracking status updates. - Built with the Singer SDK for extensibility and Meltano compatibility.
-
Python 3.9+
-
DHL eCommerce Americas Client ID & Secret
-
Singer SDK
-
Meltano (optional, for pipeline orchestration)
- Clone the repository:
git clone https://github.com/fixdauto/tap-dhl-ecommerce.git
cd tap-dhl-ecommerce
- Install the dependencies:
poetry install
- Activate the Poetry virtual environment:
poetry shell
- Create a config.json file with the following structure:
{
"pickup_id": "YOUR_DHL_ACCOUNT_PICKUP_ID",
"client_id": "YOUR_DHL_CLIENT_ID",
"client_secret": "YOUR_DHL_CLIENT_SECRET"
}
-
pickup_id
: Your DHL eCommerce Americas account pickup ID. -
client_id
: Your DHL eCommerce Americas client ID. -
client_secret
: Your DHL eCommerce Americas client secret.
- Place config.json in the root directory or pass its path as an argument when running the tap.
- Run the tap standalone:
poetry run python -m tap_dhl_ecommerce --config config.json
- Use with Meltano for pipeline orchestration:
- Add the tap to your Meltano project:
meltano add extractor tap-dhl-ecommerce
- Configure the tap in meltano.yml:
extractors:
tap-dhl-ecommerce:
config:
pickup_id: YOUR_DHL_ACCOUNT_PICKUP_ID
client_id: YOUR_DHL_CLIENT_ID
client_secret: YOUR_DHL_CLIENT_SECRET
- Run the tap via Meltano:
meltano run tap-dhl-ecommerce target-your-target
A full list of supported settings and capabilities for this tap is available by running:
tap-dhl-ecommerce --about
This Singer tap will automatically import any environment variables within the working directory's
.env
if the --config=ENV
is provided, such that config values will be considered if a matching
environment variable is set either in the terminal context or in the .env
file.
Testing with Meltano
Next, install Meltano (if you haven't already) and any needed plugins:
# Install meltano
pipx install meltano
# Initialize meltano within this directory
cd tap-dhl-ecommerce
meltano install
Now you can test and orchestrate using Meltano:
# Test invocation:
meltano invoke tap-dhl-ecommerce --version
# OR run a test `elt` pipeline:
meltano run tap-dhl-ecommerce target-jsonl
The streams.py file provides the main logic for fetching and processing data. Key points of customization include:
-
Date Range: Modify the date range being requested by changing the
start_date
variable in theget_records
method. -
Date Interval: This script defaults to requesting data day by day, but that can be adjusted by changing the
interval_in_days
parameter in thedate_range
method.
- Install development dependencies using Poetry:
poetry install --with dev
- Run tests:
poery run pytest
See the dev guide for more instructions on how to use the SDK to develop your own taps and targets.