Skip to main content

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.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_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spond_classes-0.14.0.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spond_classes-0.14.0-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

Details for the file spond_classes-0.14.0.tar.gz.

File metadata

  • Download URL: spond_classes-0.14.0.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.3 Linux/6.8.0-51-generic

File hashes

Hashes for spond_classes-0.14.0.tar.gz
Algorithm Hash digest
SHA256 57ad375973b452d5d761fcab1394ef7b0356304c5b42b06a25a4761c4fdb839f
MD5 eea78f012f827ff072d524250ae0a9f5
BLAKE2b-256 0948e26211758a3e6a9c518e6d5e191533f611a4e38a592eca808c42bd1fb0ad

See more details on using hashes here.

File details

Details for the file spond_classes-0.14.0-py3-none-any.whl.

File metadata

  • Download URL: spond_classes-0.14.0-py3-none-any.whl
  • Upload date:
  • Size: 22.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.3 Linux/6.8.0-51-generic

File hashes

Hashes for spond_classes-0.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c38203c2bc74b94c4bc0bd0f9c9d929cd8c1f116676a9e61d07f737d0ec7856
MD5 9d2b48bdab2b529c9597c1addf04d9f2
BLAKE2b-256 aa306bb682bbdd72b7b5992b9d148969ca7e3ffe51e91656efecef1ec34bb99a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page