Skip to main content

Tracing Platform Python SDK

Official Python SDK for the Tracing Platform — EPCIS 2.0 supply chain traceability with DID + Blockchain anchoring.

Installation

pip install tracing-platform-sdk

Requirements

  • Python 3.8+
  • aiohttp >= 3.8.0
  • pydantic >= 2.0.0

Quick Start

import asyncio
from tracing_sdk import TracingClient, TracingClientOptions

async def main():
    client = TracingClient(TracingClientOptions(
        base_url="https://api.tracingplatform.com",
        client_id="your_client_id",
        client_secret="your_client_secret",
    ))

    # Commission a new LOT
    event = await client.commission.create({
        "signerDidHash": "did:neo:abc123",
        "productId": 1,
        "lotCode": "LOT-2024-001",
        "quantity": 100,
        "uom": "KGM",
        "productionDate": "2024-01-15",
        "bizLocation": "urn:epc:id:sgln:...",
        "bizStep": "commissioning",
        "disposition": "active",
        "readPoint": "urn:epc:id:sgln:...",
    })
    print(event)

asyncio.run(main())

Authentication

The SDK uses OAuth2 client_credentials flow automatically:

client = TracingClient(TracingClientOptions(
    base_url="https://api.tracingplatform.com",
    client_id="your_client_id",       # from API Credentials page
    client_secret="your_client_secret",
    scopes=["commission.write", "shipping.read"],  # optional — omit for full access
))

Tokens are cached and refreshed automatically.

Available Modules

Module Access Description
client.commission commission.read/write LOT genesis events
client.aggregation aggregation.read/write Pack/unpack containers
client.shipping shipping.read/write Shipment creation + ASN
client.receiving receiving.read/write QC + custody transfer
client.transformation transformation.read/write Input LOTs → Output LOT
client.recall recall.read/write Recall alerts management
client.custody custody.read Custody ledger overview
client.traceability traceability.read LOT timeline + tree
client.anchor anchor.read Blockchain verification
client.products products.read/write Product catalog
client.did_profile did_profile.read/write DID + location management
client.members members.read/write Team member management
client.auth Token introspection
client.ops ops.write Batch supply chain operations

Error Handling

from tracing_sdk import TracingClient, AuthError, ValidationError, NotFoundError

try:
    event = await client.commission.create(...)
except AuthError:
    print("Invalid credentials or expired token")
except ValidationError as e:
    print(f"Validation failed: {e}")
except NotFoundError:
    print("Resource not found")

Pagination

from tracing_sdk import PaginationHelper

# Fetch all pages automatically
all_events = await PaginationHelper.fetch_all(
    client.commission.list,
    params={"page": 1, "limit": 50},
)

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tracing_platform_sdk-1.0.1.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tracing_platform_sdk-1.0.1-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file tracing_platform_sdk-1.0.1.tar.gz.

File metadata

  • Download URL: tracing_platform_sdk-1.0.1.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for tracing_platform_sdk-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d5579e89315f15d2a03de9057ed42f742eaabada7234d62538c8a4647ed32fe9
MD5 6deb37e2c3ccdaf46c011f3d15263cf7
BLAKE2b-256 84a6bb583dde1dd5340f6091ae296c21e732d9b4eda8208e7789194185de7a05

See more details on using hashes here.

File details

Details for the file tracing_platform_sdk-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for tracing_platform_sdk-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 129729ee37171ac5052d0f62a41f1f0736d76a39a9c421a5468f58307e824dcf
MD5 bb7dc6b1babefb059b90ed879697e7ff
BLAKE2b-256 c9b86e0eff2257d59480c55615cb97335b69f48b16b1b5d45302f75cada968c1

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page