Simple, unofficial library with some example scripts to access data from the Spond API.
Warning
Version 0.99 is a test with some breaking changes before doing release 1.0 really soon.
pip install spond
You need a username and password from Spond
import asyncio
from spond import spond
username = '[email protected]'
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())
Get details of all your group memberships and all members of those groups.
Get details of events, limited to 100 by default. Optional parameters allow filtering by start and end datetimes, group; more events to be returned; inclusion of 'scheduled' events.
Get a member's details.
Get all your messages.
Send a message with content text
.
Either specify an existing chat_id
, or both user
and group_uid
for a new chat.
Get details of the last 1K posts.
The following scripts are included as 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.
Generates an ics-file of upcoming events.
Generates a json-file for each group you are a member of.
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.
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.