Incredibly Easy Python Scripts for Metrc

Hey everyone, I'm excited to announce the newest addition to the T3 platform: T3 Scripts.

Users often ask for ways to generate reports, analyze Metrc data, or automate repetitive tasks, but each request is a little bit different. The T3 API already supports all of this, but scripting and APIs are out of reach for many. Building custom one-off tools isn’t scalable, so T3 Scripts bridges that gap.

It makes creating Python scripts that talk to the T3 API simple, powered by two pieces:

Live Demo: https://www.youtube.com/watch?v=GjHhyuLTh20

If you want to see how easy it is to use, here's a script that authenticates, loads out all active packages for a selected license, and dumps it all to a JSON file. You just run it with uv run load-all-packages.py

load-all-packages.py

```python

!/usr/bin/env python3

/// script

requires-python = ">=3.8"

dependencies = [

"t3api_utils",

]

///

from t3api_utils.api.parallel import load_all_data_sync from t3api_utils.main.utils import (get_authenticated_client_or_error, interactive_collection_handler, pick_license)

api_client = get_authenticated_client_or_error()

license = pick_license(api_client=api_client)

all_packages = load_all_data_sync( client=api_client, path="/v2/packages/active", license_number=license["licenseNumber"], )

interactive_collection_handler(data=all_packages) ``` Source: https://github.com/classvsoftware/t3-api-examples/blob/master/load-all-packages.py

Learn more on the T3 WIki: https://github.com/classvsoftware/t3-wiki/wiki/T3-API-:-API-Scripts#api-scripts

t3api-utils documentation: https://github.com/classvsoftware/t3-wiki/wiki/T3-API-:-Python-Utils

submitted by /u/mattfriz to r/metrc
[link] [comments]

Published: 2025-09-29T19:39:08+00:00

Link: https://www.reddit.com/r/metrc/comments/1ntrrjd/incredibly_easy_python_scripts_for_metrc/