aftership-sdk-python
aftership-sdk-python is Python SDK (module) for AfterShip API. Module provides clean way to access API endpoints.
IMPORTANT NOTE
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
Installation
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 aftership-sdk-python.zip
Usage
You need a valid API key to use this SDK. If you don’t have one, please visit https://www.aftership.com/apps/api.
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.
export AFTERSHIP_API_KEY=THIS_IS_MY_API_KEY
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
Exceptions are mapped from https://docs.aftership.com/api/4/errors, and this table is the exception attributes mapping.
API error |
AfterShipError |
|---|---|
http status code |
|
|
|
|
|
Keyword arguments
Most of SDK functions only accept keyword arguments.
Examples
Goto examples to see more examples.
Metadata
Release files for aftership 1.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aftership-1.4.1.tar.gz | 7.6 kB | Without provenance | Details for aftership-1.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aftership-1.4.1-py3-none-any.whl | Python 3 | none | any | Details for aftership-1.4.1-py3-none-any.whl |
Total release size: 18.2 kB
Release files / aftership-1.4.1.tar.gz
| Download URL | aftership-1.4.1.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5fe73a5a4ee7b2bfc7c28ec41fe66798600b43ab45936662478ee66ad44b537b
|
|
BLAKE2b-256 checksum How to use checksums |
79ddc70b4fd12433b59f427d716353a8e2a216c8647a18eaf5073ed05cbedae1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / aftership-1.4.1-py3-none-any.whl
| Download URL | aftership-1.4.1-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e5027cba9f07fee36e05f4a1cfdc2dc842c2e0256fa008363b80d87233e7b315
|
|
BLAKE2b-256 checksum How to use checksums |
61fa27f3a203ffffff4be54a65dc5c7c38647dd2418b1601b1924a594ad404b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for aftership 1.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.