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.16.1.tar.gz (19.4 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.16.1-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for spond_classes-0.16.1.tar.gz
Algorithm Hash digest
SHA256 7c268aa643ddd3466b8a49cfc5e379204b3b795a9548489fbb7e9d887601e063
MD5 43a3ecdd8f45ca929bdf47389e4f37bf
BLAKE2b-256 d9eea337ccd76e45f4875731bc2217ce3ec82c5ff82b2120e4a11f54e95e7826

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for spond_classes-0.16.1-py3-none-any.whl
Algorithm Hash digest
SHA256 73c9760752a059892cf3f26a1965770026498d672cb821ce69719e00995568ec
MD5 540e9d46f8ff0f0b31e620183ef7de0a
BLAKE2b-256 5a028529a0cf929880969a2134a13d466f7c5a3152ff15c7dd0a8ab0a4c2a319

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