A library for the ChurchTools API
Project description
pychurchtools
This is a python wrapper for the ChurchTools API. The API from ChurchTools is provided using the Swagger toolset.
Note: This library is WIP. Some endpoints are not implemented at all and the others are only partly implemented.
Installation
To install from PyPI, you can use "pip install churchtools
".
Type "pip uninstall churchtools
" to remove the library.
Dependencies:
pydantic
requests
Usage
Authentication
Via a cookie
Login to churchtools in your browser and copy the cookie. The cookie object looks something like this:
cookie = {
'ChurchTools_ct_<church_name>': 'some_random_text',
}
Pass this object to the init function of the ChurchTools
class or set the
field cookie
in the ChurchTools
object.
Via REST API
The ChurchTools
class provides a method login
to log you in and set the
cookie automatically.
ct.login('your_email', 'your_password')
Example
You can execute the following in a python script to test the functionality.
from churchtools import ChurchTools
c = ChurchTools('https://<church_name>.church.tools')
c.login('your_email', 'your_password')
events = c.events.list()
print('Upcoming event:', events[0].__repr__())
print(events[0].dict())
print()
me = c.general.whoami()
print('Logged in as:', me.__repr__())
print()
my_events = c.person.events(me.id)
print('Your next events:')
[print(f'- {e.__repr__()}') for e in my_events]
Notes
- Set the
debugging
field from 0 - 2 for none to many debug messages. - Times are in UTC
Tests
- Create a CT instance here: https://ccp.church.tools/demo
- Set the environment variables
CHURCHTOOLS_URL
,CHURCHTOOLS_USER
&CHURCHTOOLS_PASSWORD
- Run
pytest
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
File details
Details for the file churchtools-0.4.0.tar.gz
.
File metadata
- Download URL: churchtools-0.4.0.tar.gz
- Upload date:
- Size: 31.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13eda8ac453ad8081dcd3ad9026680cbdd07839a4cc6b19dae62b349792f2bd1 |
|
MD5 | e0b098315596b5df14b5fdb35834b9bc |
|
BLAKE2b-256 | ced8a2191bda9863c1a0b53a8d1fc87bc2e3f3ab8d833a9a40d3eddf41a761fa |
File details
Details for the file churchtools-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: churchtools-0.4.0-py3-none-any.whl
- Upload date:
- Size: 41.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee1a7739bed43c52072be794383e9be94e1558763c9279980284a0b922531879 |
|
MD5 | 452883a1b74276b8727423f615c315e1 |
|
BLAKE2b-256 | 6129b60268710100b10797dd9abcd7e963d3a959b7f1f366e7c9094cfbd1925e |