A Simple Python API for 17track.net
Project description
📦 py17track: A Simple Python API for 17track.net
py17track
is a simple Python library to track packages in
17track.net accounts.
Since this is uses an unofficial API, there's no guarantee that 17track.net will provide every field for every package, all the time. Additionally, this API may stop working at any moment.
Python Versions
py17track
is currently supported on:
- Python 3.6
- Python 3.7
- Python 3.8
Installation
pip install py17track
Usage
py17track
starts within an
aiohttp ClientSession
:
import asyncio
from aiohttp import ClientSession
from py17track import Client
async def main() -> None:
"""Create the aiohttp session and run the example."""
async with ClientSession() as websession:
# YOUR CODE HERE
asyncio.get_event_loop().run_until_complete(main())
Create a client then get to it:
import asyncio
from aiohttp import ClientSession
from py17track import Client
async def main() -> None:
"""Create the aiohttp session and run the example."""
async with ClientSession() as websession:
client = Client(websession)
# Login to 17track.net:
await client.profile.login('<EMAIL>', '<PASSWORD>')
# Get the account ID:
client.profile.account_id
# >>> 1234567890987654321
# Get a summary of the user's packages:
summary = await client.profile.summary()
# >>> {'In Transit': 3, 'Expired': 3, ... }
# Get all packages associated with a user's account:
packages = await client.profile.packages()
# >>> [py17track.package.Package(..), ...]
asyncio.get_event_loop().run_until_complete(main())
Each Package
object has the following info:
destination_country
: the country the package was shipped tofriendly_name
: the human-friendly name of the packageinfo
: a text description of the latest statuslocation
: the current location (if known)origin_country
: the country the package was shipped frompackage_type
: the type of package (if known)status
: the overall package status ("In Transit", "Delivered", etc.)tracking_info_language
: the language of the tracking infotracking_number
: the all-important tracking number
Contributing
- Check for open features/bugs or initiate a discussion on one.
- Fork the repository.
- (optional, but highly recommended) Create a virtual environment:
python3 -m venv .venv
- (optional, but highly recommended) Enter the virtual environment:
source ./venv/bin/activate
- Install the dev environment:
script/setup
- Code your new feature or bug fix.
- Write tests that cover your new functionality.
- Run tests and ensure 100% code coverage:
script/test
- Update
README.md
with any new documentation. - Add yourself to
AUTHORS.md
. - Submit a pull request!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py17track-2.2.6.tar.gz
(9.7 kB
view hashes)
Built Distribution
Close
Hashes for py17track-2.2.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea5a7ff075690c3f6a54e9a91bd27692882088551ef72d6df849ae11fd71a651 |
|
MD5 | 26a881fa1725b9fe11f8b457d92629cc |
|
BLAKE2b-256 | 82c769513aa234231211bbf7c91e759082bdc41a6032097feafc4ad637dfd4f1 |