Unofficial class abstraction layer for the `spond` library package.
Project description
Spond-classes
About
Spond is a team/group-oriented events system.
The unofficial Python spond
library package gets
data from the Spond API and returns dict
objects.
This unofficial Python spond-classes
library package parses those dict
objects to
create Pydantic class instances.
Partial, read-only implementation.
Install
Install from PyPI, e.g:
pip install spond-classes
Or if you're using Poetry:
poetry add spond-classes
Note that spond
is required for practical use, but not a technical dependency,
so needs to be installed separately.
Example code
Adapting the example code in Spond
README:
import asyncio
from spond.spond import Spond
from spond_classes import Group
# fake credentials and ids
USERNAME = 'my@mail.invalid'
PASSWORD = 'Pa55worD'
GROUP_ID = 'G1'
SUBGROUP_ID = 'SG1'
async def main():
s = Spond(username=USERNAME, password=PASSWORD)
group_data = await s.get_group(GROUP_ID)
await s.clientsession.close()
# Now we can create a class instance ...
group = Group.model_validate(group_data)
# or `spond_classes.Group(**group_data)`
# ... use class attributes instead of dict keys ...
print(group.name)
# ... access subordinate instances and their attributes ...
for member in group.members:
print(f"{member.full_name} is in the {group.name} group")
# ... and use some helper methods
subgroup = group.subgroup_by_id(SUBGROUP_ID)
for member in group.members_by_subgroup(subgroup):
print(f"{member.full_name} is in the {subgroup.name} subgroup")
asyncio.run(main())
Documentation
Full API documentation is published at https://elliot-100.github.io/Spond-classes/ and
is also included as HTML in the package source docs
folder.
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
File details
Details for the file spond_classes-0.13.0.tar.gz
.
File metadata
- Download URL: spond_classes-0.13.0.tar.gz
- Upload date:
- Size: 19.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.0 Windows/11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c011a124afc5c3f0781083a1de5389c3f6ba64e658ab6932de2c99c691c83ed6 |
|
MD5 | adf2e56ddc1008b143e843d4497e1423 |
|
BLAKE2b-256 | 643d4b76ee1b74f6b80675ddc3e38c9b1ccab00e3f58b6e863e007f5478e4977 |
File details
Details for the file spond_classes-0.13.0-py3-none-any.whl
.
File metadata
- Download URL: spond_classes-0.13.0-py3-none-any.whl
- Upload date:
- Size: 21.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.0 Windows/11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a0e705ea6072a91936ce590e702b2060150964b5c6ed5445f94fcabe88363c2 |
|
MD5 | 5c0ef776bec65ca750a6546ebaa6a8f4 |
|
BLAKE2b-256 | a57df3620f0387a10abf30bea367b94273c8ab22004fb4eeeb6e928d5a8f95ca |