Skip to main content

Asynchronous Python client for OneTracker.

Project description

PyPI PyPI - Downloads GitHub

OneTracker-API

Asynchronous Python client for OneTracker.

Installing

pip install onetracker-api

Quick-Start Example

import asyncio

from onetracker_api import OneTracker
from onetracker_api.models import SessionObject

async def main():
    async with OneTracker() as onetracker:
        # Authenticate with the OneTracker API
        await onetracker.login("demo@onetracker.app", "P@S5W0RD!")
        # > AuthenticationTokenResponse(message='ok', session=SessionObject(user_id=156, token='eP0FUZhN76Wu7igUkCPigR2wEMBDtzaW', expiration=datetime.datetime(2020, 8, 3, 3, 15, 54)))

        # Get a list of parcels, archived defaults to false
        parcels = await onetracker.list_parcels(archived=False)
        # > ListParcelsResponse(message='ok', parcels=[Parcel(id=174, user_id=6, email_id=183, email_sender='example.com', retailer_name='Example', description='Camera', notification_level=1, is_archived=0, carrier='FedEx', carrier_name='FedEx', carrier_redirection_available=True, tracker_cached=False, tracking_id='407072905722', tracking_url='', tracking_status='delivered', tracking_status_description='', tracking_status_text='', tracking_extra_info='', tracking_location='Sunnyvale, CA', tracking_time_estimated=datetime.datetime(2018, 8, 8, 20, 0, 0), tracking_time_delivered=datetime.datetime(2018, 8, 8, 15, 51, 0), tracking_lock=0, tracking_events=[], time_added=datetime.datetime(2018, 8, 7, 0, 50, 30), time_updated=datetime.datetime(2018, 8, 18, 20, 1, 23))])

        # Get a single parcel
        parcel = await onetracker.get_parcel(id=174)
        # > GetParcelResponse(message='ok', parcel=Parcel(id=174, user_id=6, email_id=183, email_sender='example.com', retailer_name='Example', description='Camera', notification_level=1, is_archived=0, carrier='FedEx', carrier_name='FedEx', carrier_redirection_available=True, tracker_cached=False, tracking_id='407072905722', tracking_url='', tracking_status='delivered', tracking_status_description='', tracking_status_text='', tracking_extra_info='', tracking_location='Sunnyvale, CA', tracking_time_estimated=datetime.datetime(2018, 8, 8, 20, 0, 0), tracking_time_delivered=datetime.datetime(2018, 8, 8, 15, 51, 0), tracking_lock=0, tracking_events=[], time_added=datetime.datetime(2018, 8, 7, 0, 50, 30), time_updated=datetime.datetime(2018, 8, 18, 20, 1, 23)))

        # Delete a parcel
        parcel = await onetracker.delete_parcel(id=174)
        # > DeleteParcelResponse(message='ok')

if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())

See Also

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

onetracker_api-0.0.1.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

onetracker_api-0.0.1-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file onetracker_api-0.0.1.tar.gz.

File metadata

  • Download URL: onetracker_api-0.0.1.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.3

File hashes

Hashes for onetracker_api-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2ebddc7c1c9539a9267391e3fe479b49e5928314878188d59ba3a807dc4c97e8
MD5 8ddd9567ac20b30bd12cb496e87b2ee2
BLAKE2b-256 a1a628b4bfa9ef69b88c917bb2d5b679f41fa685ea1f41b40930801618bd128b

See more details on using hashes here.

File details

Details for the file onetracker_api-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: onetracker_api-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 20.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.3

File hashes

Hashes for onetracker_api-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 075860fa1f64ac441127f016f44e52db71a8a1601b8c7fcc55ebfcde411ae8e4
MD5 ddc5c7d8a4d274a0ddc74431dfe16282
BLAKE2b-256 bc6da58af8f62b5cc144baa46ed767b43a99bc3df5d3d308a8cd1278f4572ac0

See more details on using hashes here.

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