The unofficial API to the TSA Compass membership database
Project description
Compass Interface - Core
The Compass Interface project aims to provide a unified and well-documented API to the Scouts' national membership system, Compass.
Notice
This is not an official API to Compass and as such should be used in a way that doesn't cause a high request load on the Compass system.
Please also remember your personal data handling obligations (under both GDPR and Scouting policies) whilst using this module.
Where to get it
The source code for the project is hosted on GitHub at the-scouts/compass-interface-core
Installers for the latest release are availibe on Conda and at the Python Package Index (PyPI).
# conda
conda install compass-interface-core
# or PyPI
pip install compass-interface-core
Dependencies
- requests - for intuitive HTTP requests
- lxml - for parsing HTML documents
- pydantic, email-validator, phonenumbers - for data validation and parsing
License
Compass Interface - Core is naturally open source and is licensed under the MIT license.
Core Module
This sub-project hosts the extraction functionaility of Compass Interface, and is itself a standalone module for querying Compass.
The main project is found at the-scouts/compass-interface.
Example Usage
import compass.core as ci
# Turn on debug logging for development
ci.logger.enable_debug_logging()
# Login to Compass
compass_session = ci.login("username", "password")
# Setup Compass Helpers
hierarchy = ci.Hierarchy(compass_session)
people = ci.People(compass_session)
# Get all unique members from your hierarchy
member_set = hierarchy.get_unique_members()
Specifying a role
By default, Compass Interface uses your primary role to access Compass. To
change this, a custom role can be specified when calling ci.login
, as
follows:
import compass.core as ci
# Turn on debug logging for development
ci.logger.enable_debug_logging()
# Login to Compass
compass_session = ci.login("username", "password", role="role_as_on_compass")
The string passed to the role
argument must match the role title on Compass
exactly, as they are compared internally. You can validate that the role has
updated successfully through the log output.
Specifying a role and location
If you have multiple roles with the same title on compass (for example, two
Group Administrator
or Scout Active Support Manager
roles), these can be
differentiated by also specifying a role location, as follows:
import compass.core as ci
# Turn on debug logging for development
ci.logger.enable_debug_logging()
# Login to Compass
compass_session = ci.login("username", "password", role="role_as_on_compass", location="location_as_on_compass")
As with the role title, the location needs to match the text in the Location
column of My Roles
exactly, as we verify the text matches internally.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for compass-interface-core-0.9.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfcdb3e2e2f44b1e6cd22940af1b315e032077e29a6c187e48c3fd740199dbd8 |
|
MD5 | 451849b0b78887946cdb4d7f008b30f4 |
|
BLAKE2b-256 | e2f08f275286b40782cdd103c3a463f56f73fa0d9be629df9bca1dd04e3f61ea |
Hashes for compass_interface_core-0.9.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2306b4493db59e3bd98f9dc33d980b3a731561b6e0d18ca2ef7ce19926b6cc3 |
|
MD5 | fcb4cf21655719a11cdce963c27351ba |
|
BLAKE2b-256 | abcc6a2c1ef036f4ecf79e2364d20f71f5ed06e222e7d5f888c9e276ae166c80 |