Spond is a team/group-oriented events system.
The unofficial Python spond library package (GitHub,
PyPI) gets data from the Spond API and returns
dict objects.
This unofficial Python spond-classes library package
(GitHub,
PyPI) parses those dicts using
Pydantic to create class instances.
Partial, read-only implementation.
Install from PyPI, e.g:
pip install spond-classesOr if you're using Poetry:
poetry add spond-classesNote that spond is required for practical use, but
is not a technical dependency, so needs to be installed separately.
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.from_dict(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_uid(SUBGROUP_ID)
for member in group.members_by_subgroup(subgroup):
print(f"{member.full_name} is in the {subgroup.name} subgroup")
asyncio.run(main())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.
Build documentation:
pdoc spond_classes -d numpy -t docs_templates -o docs