t3api-utils¶
Python utilities for the T3 (Track and Trace Tools) API.
Provides authentication, data collection, processing, and export tools for working with Metrc cannabis regulatory data through the T3 API.
Installation¶
Quick Start¶
from t3api_utils.main.utils import get_authenticated_client_or_error
from t3api_utils.api.operations import get_collection
# Authenticate (interactive picker for credentials, JWT, or API key)
client = get_authenticated_client_or_error()
# Fetch a paginated collection
response = get_collection(client, "/v2/packages", license_number="LIC-0001")
Package Overview¶
| Module | Description |
|---|---|
api |
httpx-based API client with async support and paginated collection fetching |
auth |
Authentication utilities for credentials, JWT, and API key flows |
http |
Low-level httpx client construction with retry policies and rate limiting |
db |
DuckDB-backed data flattening, table creation, and schema export |
file |
CSV/JSON serialization and file output utilities |
collection |
Parallel data loading and extraction helpers |
openapi |
OpenAPI spec fetching and interactive endpoint selection |
cli |
CLI configuration management and interactive credential prompting |
style |
Rich console theming and styled message helpers |
inspector |
Textual TUI for interactive collection browsing |
Data Flow¶
- Authentication (
auth) - Create authenticated httpx-based API clients - Collection (
api) - Parallel data fetching with rate limiting - Processing (
db) - Flatten nested data and create relational tables - Output (
file) - Export to CSV/JSON formats