GilbN / Spond

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spond

spond logo

Simple library with some example scripts to access data from Spond.

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'

async def main():
    s = spond.Spond(username=username, password=password)
    groups = await s.getGroups()
    for group in groups:
        print(group['name'])
    await s.clientsession.close()


loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Functions

getGroups()

Gets all your group memberships and all members of those groups

getEvents([from_date])

Gets up to 100 events.

Optional from_date parameter determines the earliest date from which events are returned. Pass a datetime to get earlier events, e.g.:

events = await spond_session.getEvents(datetime.now() - timedelta(days=365))

If omitted, returns events from today - 14 days.

getEventsBetween(from_date, to_date)

Gets up to 100 events.

Required from_date and to_date parameters determines the earliest and latest date from which events are returned. Both expect a datetime object, e.g.:

from_date = datetime.now() - timedelta(days=30)
to_date = datetime.now() + timedelta(days=30)

events = await spond_session.getEventsBetween(from_date, to_date)

Will return up to 100 events starting from 30 days in the past until 30 days in the future.

getPerson()

Get information about a member

getMessages()

Get all your messages

sendMessage(recipient, text)

Send a message to recipient with the content text

Example scripts

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.

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.

About

License:GNU General Public License v3.0


Languages

Language:Python 100.0%