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 (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

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 is 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_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())

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.

Development

Build documentation:

pdoc spond_classes -d numpy -t docs_templates -o docs

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.17.0.tar.gz (19.7 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.17.0-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spond_classes-0.17.0.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.8.0-86-generic

File hashes

Hashes for spond_classes-0.17.0.tar.gz
Algorithm Hash digest
SHA256 a0b8a96c83f91ee83ca2c7312ee164f6888f9836b7912f572733516c1e42de41
MD5 0bb09396894dbd1d5730a388610a1a8b
BLAKE2b-256 dc327294238fdd885a68e400c14f554610a3b638a21c377e2c24be06c2346183

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for spond_classes-0.17.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d9e57ea2eaab03fee7d9e3292ce70c3e6bb3f6557441a32bcbb21d56dacbf69f
MD5 544dea5f90a15f8faf8f39d92d79f140
BLAKE2b-256 9a44cb6f032a1a3652e66f698f8d09da150d10743e2d3d2645159a1c6083c831

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