Tiny OpenADR 3 compatible client Python Library
Project description
toadr3
Tiny OpenADR3 Python Library
This Python library is a tiny OpenADR3 library that can be used to perform a minimal set of operations towards a VTN.
Currently, it supports the following operations:
- List events [GET]
- Filter by program id
- Filter by target type and target values
- Limit and skip for pagination
- List programs [GET]
- Filter by target type and target values
- Limit and skip for pagination
- List reports [GET]
- Filter by program id
- Filter by event id
- Filter by client name
- Limit and skip for pagination
- List subscriptions [GET]
- Filter by program id
- Filter by client name
- Filter by target type and target values
- Filter by objects
- Limit and skip for pagination
- Update a subscription [PUT]
- Delete a subscription [DELETE]
- Get a subscription by id [GET]
- Update a program [PUT]
- Delete a program [DELETE]
- Get a program by id [GET]
- Create a report [POST]
- Create a subscription [POST]
- Create a report object based on an initial event
Example
A small example of how to list programs and events and create a report:
import asyncio
import toadr3
OAUTH_CONFIG = toadr3.OAuthConfig(
token_url="", # URL to the OAuth2 token endpoint
grant_type="", # OAuth2 grant type
claims={"scope": ""}, # OAuth2 claims, for example 'scope'
client_id="", # OAuth2 client ID or set to None use environment variable
client_secret="", # OAuth2 secret or set to None use environment variable
)
VTN_URL = "" # URL to the VTN
async def main():
async with toadr3.ToadrClient(vtn_url=VTN_URL, oauth_config=OAUTH_CONFIG) as client:
programs = await client.get_programs()
for program in programs:
print(f"Program: ID={program.id}, Name={program.program_name}")
events = await client.get_events()
for event in events:
print(f"Event: ID={event.id}, Name={event.event_name}, Date={event.created_date_time}")
report = toadr3.models.Report.create_report(
event=events[0],
client_name="ReadmeClient",
report_type="README_REPORT",
report_values=[True],
)
try:
result = await client.post_report(report)
print(f"Report created with ID={result.id}")
except toadr3.ToadrError as e:
print(f"ToadrError: {e}")
if __name__ == '__main__':
asyncio.run(main())
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file toadr3-0.29.0.tar.gz.
File metadata
- Download URL: toadr3-0.29.0.tar.gz
- Upload date:
- Size: 25.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ddab74ca31efe01567dfd25c1675b2984f997eab7b80f761c2572ee3c97339e
|
|
| MD5 |
d1e54a6be9079fee93dc7a580e03a087
|
|
| BLAKE2b-256 |
8198cdaaf130b4c82039e62a0d4f7bed4588e8e2f3ba370c26d7102cc0e9e39d
|
Provenance
The following attestation bundles were made for toadr3-0.29.0.tar.gz:
Publisher:
publish.yml on prelectai/toadr3
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
toadr3-0.29.0.tar.gz -
Subject digest:
6ddab74ca31efe01567dfd25c1675b2984f997eab7b80f761c2572ee3c97339e - Sigstore transparency entry: 724608410
- Sigstore integration time:
-
Permalink:
prelectai/toadr3@0c7b79f09763df3605e64d8bdd922d31fb324448 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/prelectai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0c7b79f09763df3605e64d8bdd922d31fb324448 -
Trigger Event:
push
-
Statement type:
File details
Details for the file toadr3-0.29.0-py3-none-any.whl.
File metadata
- Download URL: toadr3-0.29.0-py3-none-any.whl
- Upload date:
- Size: 39.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8b298205082f2c5d86d182bc0c58e237812f69e7aaeb07312d86ca578f81974
|
|
| MD5 |
f94fb66884b4771516cd1a1d0fa12e78
|
|
| BLAKE2b-256 |
f472ca452ec9b51ac77cbe1d15869fc0f270111e7a51d6f102daf0bb61bdbfa7
|
Provenance
The following attestation bundles were made for toadr3-0.29.0-py3-none-any.whl:
Publisher:
publish.yml on prelectai/toadr3
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
toadr3-0.29.0-py3-none-any.whl -
Subject digest:
b8b298205082f2c5d86d182bc0c58e237812f69e7aaeb07312d86ca578f81974 - Sigstore transparency entry: 724608441
- Sigstore integration time:
-
Permalink:
prelectai/toadr3@0c7b79f09763df3605e64d8bdd922d31fb324448 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/prelectai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0c7b79f09763df3605e64d8bdd922d31fb324448 -
Trigger Event:
push
-
Statement type: