Skip to main content

The python SDK of AfterShip API

Project description

aftership-sdk-python is Python SDK (module) for AfterShip API. Module provides clean way to access API endpoints.


Current version of aftership-sdk-python >=0.3 not compatible with previous version of sdk <=0.2.

Also, version since 1.0 is not support Python 2.X anymore. If you want to use this SDK under Python 2.X, please use versions <1.0.

Supported Python Versions

  • 3.6

  • 3.7

  • 3.8

  • 3.9

  • 3.10

  • pypy3


Via pip

Use Virtual Environment

We recommend using a virtualenv or poem to use this SDK.

$ pip install aftership

Via source code

Download the code archive, without unzip it, go to the source root directory, then run:

$ pip install


You need a valid API key to use this SDK. If you don’t have one, please visit

Quick Start

The following code gets list of supported couriers

import aftership
aftership.api_key = 'YOUR_API_KEY_FROM_AFTERSHIP'
couriers = aftership.courier.list_couriers()

You can also set API key via setting AFTERSHIP_API_KEY environment varaible.

import aftership
tracking = aftership.get_tracking(tracking_id='your_tracking_id')

The functions of the SDK will return data field value if the API endpoints return response with HTTP status 2XX, otherwise will throw an exception.


Exceptions are mapped from, and this table is the exception attributes mapping.

API error


http status code






Keyword arguments

Most of SDK functions only accept keyword arguments.


Goto examples to see more examples.

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

aftership-1.4.1.tar.gz (7.6 kB view hashes)

Uploaded Source

Built Distribution

aftership-1.4.1-py3-none-any.whl (10.6 kB view hashes)

Uploaded Python 3

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