Skip to main content

django-17track is an unofficial API wrapper for Django.

Project description

Build status Project Status Python versions PyPI downloads Software license Project Status

django-17track is an unofficial API wrapper for Django.


Install with pip:

$ pip install django-ok-17track



Make migrations

$ python migrate

Available settings

TRACK17_API_KEY - API key for service.

TRACK17_API_KEY_FUNCTION - Custom function to return API key, if you want to store it outside the Django settings.

TRACK17_COUNTRIES_URL - Url to grab countries. Uses

TRACK17_CARRIERS_URL - Url to grab carriers. Uses

Basic example to use:

How to get all countries and carriers:

python populate_carriers

How to register tracking number and get it’s info:

from rest_framework import serializers
from import register_track, get_track_info, get_track_info_as_packages
from apps.track17.exceptions import DateProcessingError

# try to register tracking number at 17track API
except DateProcessingError as exc:
raise serializers.ValidationError(str(exc))

# try to fetch an actual info about a tracking number
    response: Dict = get_track_info('tracking_number')
except DateProcessingError as exc:
    raise serializers.ValidationError(str(exc))

accepted_packages = response.get('accepted', [])

# return packages info as a list of `PackageEntity` (dataclass instance) objects
# in a readable way with a represantion of carriers and countries as Django model instances
packages = get_track_info_as_packages(accepted)

Or can use 17track adapter directly:

from track17.track17 import Track17Adapter

track17 = Track17Adapter()
response = track17.register('number1', 'number2')
response = track17.get_track_info('number1', 'number2')

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

django-ok-17track-0.0.4.tar.gz (10.3 kB view hashes)

Uploaded source

Built Distribution

django_ok_17track-0.0.4-py3-none-any.whl (13.7 kB view hashes)

Uploaded py3

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