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

Uploaded Python 3

File details

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

File metadata

  • Download URL: spond_classes-0.16.0.tar.gz
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.3 Linux/6.8.0-62-generic

File hashes

Hashes for spond_classes-0.16.0.tar.gz
Algorithm Hash digest
SHA256 1c541656cd299f9322c9fe0d51657c0e2622dab840d237a63dd666ce3a8e0b00
MD5 e60a20a1fb0939d383a9a4689bd1edc7
BLAKE2b-256 18e00901a30fb9b2a097028e694c1bf875d960dafefecc0e3664ab93ed1dd4fc

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for spond_classes-0.16.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e276a612148dd3fee77949ee40bb01b2a43357bba69b5d01d1eccc38f3b3e7f
MD5 25cf3085952517285b8f275d1cdd4d7f
BLAKE2b-256 624b59f3cead54c104e0a21ce485eb19f65c82c9f37a7a21025c28e6abcd98e5

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