Beispiele

Getestet mit Python 3.5, benötigt Bibliothek requests

Beispielbenutzung

Aufrufe der Funktionen von sn_rest.py

Events für Gruppe 4 abfragen:

sn_rest("group/4/events/")

Events für Gruppe 4 und 3 abfragen:

sn_rest("/events/","group_id=? or group_id=?",["4","3"])

Events für Gruppe 4 abfragen die vor dem 12.01.2012 liegen:

sn_rest("group/4/events/", "end_date < ?",["2012-01-12"])

Info über Gruppe 4 abfragen:

sn_rest("group/4/")

Übergeordnete Gruppe zu Gruppe 4 suchen:

sn_rest("group/4/parent/")

Beispielclient

sn_rest.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
import json
import requests


SN_REST_BASE_URL = "https://www.scoutnet.de/api/0.2/"


def sn_rest(path, *args):
    if args:
        params = {
            "json": json.dumps(args)
        }
    else:
        params = {}
    return requests.get(
        SN_REST_BASE_URL + path,
        params=params
    ).json()