Skip to main content

Simple, unofficial library with some example scripts to access data from the Spond API.

Project description

Spond

spond logo

Simple, unofficial library with some example scripts to access data from the Spond API.

Install

pip install spond

Usage

You need a username and password from Spond

Example code

import asyncio
from spond import spond

username = 'my@mail.invalid'
password = 'Pa55worD'
group_id = 'C9DC791FFE63D7914D6952BE10D97B46'  # fake 

async def main():
    s = spond.Spond(username=username, password=password)
    group = await s.get_group(group_id)
    print(group['name'])
    await s.clientsession.close()

asyncio.run(main())

Key methods

get_groups()

Get details of all your group memberships and all members of those groups.

get_events([group_id, subgroup_id, include_scheduled, max_end, min_end, max_start, min_start, max_events])

Get details of events, limited to 100 by default. Optional parameters allow filtering by start and end datetimes, group and subgroup; more events to be returned; inclusion of 'scheduled' events.

get_person()

Get a member's details.

get_messages(max_chats=100)

Get chats, limited to 100 by default. Optional parameter allows more events to be returned.

send_message(text, user=None, group_uid=None, chat_id=None)

Send a message with content text. Either specify an existing chat_id, or both user and group_uid for a new chat.

get_event_attendance_xlsx()

Get Excel attendance report for a single event, available via the web client.

change_response()

Change a member's response for an event (e.g. accept/decline)

get_posts()

Retrieve posts from group walls.

get_profile()

Retrieve information connected to the user's account.

Example scripts

The following scripts are included in examples/. Some of the scripts might require additional packages to be installed (csv, ical etc).

Rename the file config.py.sample to config.py and add your username and password to the file before running the samples.

ical.py

Generates an ics-file of upcoming events.

groups.py

Generates a json-file for each group you are a member of.

attendance.py <-f from_date> <-t to_date> [-a]

Generates a csv-file for each event between from_date and to_date with attendance status of all organizers. The optional parameter -a also includes all members that has been invited.

transactions.py

Generates a csv-file for transactions / payments appeared in Spond Club > Finance > Payments.

manual_test_functions.py

Demonstrates most get...() methods.

AsyncIO

Asyncio might seem intimidating in the beginning, but for basic stuff, it is quite easy to follow the examples above, and just remeber to prefix functions that use the API with async def ... and to await all API-calls and all calls to said functions.

This article will give a nice introduction to both why, when and how to use asyncio in projects.

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

Uploaded Python 3

File details

Details for the file spond-1.2.0.tar.gz.

File metadata

  • Download URL: spond-1.2.0.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for spond-1.2.0.tar.gz
Algorithm Hash digest
SHA256 14df72f1896ca81147c1f379012532a72c735a52523aaf25fc0703bfcea6c8a6
MD5 f845688492cb31e68f9eafd82483cbf1
BLAKE2b-256 5c6a954dc83453b87d42a5c93a08dc218be64ceaa0381dea0232361749dcf198

See more details on using hashes here.

Provenance

The following attestation bundles were made for spond-1.2.0.tar.gz:

Publisher: release.yml on Olen/Spond

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spond-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: spond-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for spond-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e14705aa37d25cbef6890ecbd5d4ef6d4a843faa5ba47e4012c6cdd3e1ccefd0
MD5 58a98a0ecd0b0f7b541584b4d43ebc53
BLAKE2b-256 edc56f8ce8f909ae5705467a49f0d1ac9c7b7186f861da465df6793d0f9c70f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for spond-1.2.0-py3-none-any.whl:

Publisher: release.yml on Olen/Spond

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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