<!-- README.md -->
[](https://github.com/andy-goellner/pco-python-sdk/actions?query=branch%main)
[](https://coveralls.io/github/andy-goellner/pco-python-sdk?branch=main)

# pco-python-sdk
A Python SDK for simplifying interactions with the Planning Center API.
## NOTE: WIP. This library is not stable and is under active development. I will release a 1.x.x version when the library has reached a stable state.
## Currently only supporting the latest version of all the APIs. Will come up with a better versioning strategy after 1.0
## Need to install
poetry
python
ruff
pre-commit
## NOTE: Not currently supporting the json fields in the attribute payloads
# Getting Started
## Installation
You don't need this source code unless you want to modify the package. If you just
want to use the package, just run:
```sh
pip install planning_center_python
```
## Contributing
TODO: Add dev instructions
This project is under active development. Feel free to contribute and submit a pull request. The project is managed with poetry and tests use pytest.
# Docs
## Webhooks
You can validate a webhook using the `WebhookSignature` class. Pass the request headers, the body of the request, and the secret to `.verify` which will return `True/False` depending if the signature is verified. A `SignatureVerificationError` will be raise for any exceptions.
## Auth and Client Setup
There is a class called `PCOToken` that wraps the token dict returned from `https://api.planningcenteronline.com/oauth/token`. NOTE: The inital auth => redirect token fetch is not yet supported.
Once you have a token instance you need to initialize a set of credentials (`Credentials`). `Credentials` takes a `client_id`, `client_secret`, a `pco_token`, and a `token_updater`. `token_updater` is a callable function that takes one argument `token` and is used to store a new token whenever a token refresh is triggered.
Create an instance of a `PCOClient` using the `Credentials` and you are off and running. You can access api resources from the client.
```python
from planning_center_python.api import PCOClient, Credentials, PCOToken
def token_saver(token):
print(token)
client_id = "myclientid"
secret = "mysecretkey"
token = {
"access_token": "pco_tok_abc",
"token_type": "Bearer",
"expires_in": 7199,
"refresh_token": "abcdefg",
"scope": ["people", "services"],
"created_at": 1737307589,
"expires_at": 1737314788.50569,
}
pco_token = PCOToken(token)
credentials = Credentials(
client_id=client_id,
client_secret=secret,
pco_token=pco_token,
token_updater=token_saver,
)
client = PCOClient(credentials=credentials)
person = client.person.get("personid")
```
NOTE: The client is a singleton. You only need to initialize it once with an `http_client` or `credentials` from then on you can call `PCOClient()` to return the already configured client.
The client also takes care of checking token expirations and will automatically refresh it using the refresh token in the credentials. After refreshing the token it will pass the new token to the function passed into the token_updater property so it can be saved if needed.
# Contributing
## Cutting a version
This repo contains semantic-release as a dev dependency. Review the changelog and ensure version notes are up to date (or that all commits in release have correct commit semantics).
Cut a new patch version.
```bash
bin/new-patch-version.sh
```
Raw data
{
"_id": null,
"home_page": null,
"name": "planning-center-python",
"maintainer": "Andy Goellner",
"docs_url": null,
"requires_python": "<3.13,>=3.10",
"maintainer_email": "andy.goellner@gmail.com",
"keywords": "sdk, planning center online",
"author": "Andy Goellner",
"author_email": "andy.goellner@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/40/0e/f822bb0ccf1fd7b3c3de734fe34d38927c1edc25d206862488da6a2346c4/planning_center_python-0.0.7.tar.gz",
"platform": null,
"description": "<!-- README.md -->\n[](https://github.com/andy-goellner/pco-python-sdk/actions?query=branch%main)\n[](https://coveralls.io/github/andy-goellner/pco-python-sdk?branch=main)\n\n\n# pco-python-sdk\nA Python SDK for simplifying interactions with the Planning Center API.\n\n\n## NOTE: WIP. This library is not stable and is under active development. I will release a 1.x.x version when the library has reached a stable state.\n\n## Currently only supporting the latest version of all the APIs. Will come up with a better versioning strategy after 1.0\n\n## Need to install\npoetry\npython\nruff\npre-commit\n\n## NOTE: Not currently supporting the json fields in the attribute payloads\n\n# Getting Started\n\n## Installation\n\nYou don't need this source code unless you want to modify the package. If you just\nwant to use the package, just run:\n\n```sh\npip install planning_center_python\n```\n\n## Contributing\n\nTODO: Add dev instructions\n\nThis project is under active development. Feel free to contribute and submit a pull request. The project is managed with poetry and tests use pytest.\n\n# Docs\n\n## Webhooks\n\nYou can validate a webhook using the `WebhookSignature` class. Pass the request headers, the body of the request, and the secret to `.verify` which will return `True/False` depending if the signature is verified. A `SignatureVerificationError` will be raise for any exceptions.\n\n\n## Auth and Client Setup\n\nThere is a class called `PCOToken` that wraps the token dict returned from `https://api.planningcenteronline.com/oauth/token`. NOTE: The inital auth => redirect token fetch is not yet supported.\n\nOnce you have a token instance you need to initialize a set of credentials (`Credentials`). `Credentials` takes a `client_id`, `client_secret`, a `pco_token`, and a `token_updater`. `token_updater` is a callable function that takes one argument `token` and is used to store a new token whenever a token refresh is triggered.\n\nCreate an instance of a `PCOClient` using the `Credentials` and you are off and running. You can access api resources from the client.\n\n```python\nfrom planning_center_python.api import PCOClient, Credentials, PCOToken\n\ndef token_saver(token):\n print(token)\n\nclient_id = \"myclientid\"\nsecret = \"mysecretkey\"\ntoken = {\n \"access_token\": \"pco_tok_abc\",\n \"token_type\": \"Bearer\",\n \"expires_in\": 7199,\n \"refresh_token\": \"abcdefg\",\n \"scope\": [\"people\", \"services\"],\n \"created_at\": 1737307589,\n \"expires_at\": 1737314788.50569,\n}\npco_token = PCOToken(token)\ncredentials = Credentials(\n client_id=client_id,\n client_secret=secret,\n pco_token=pco_token,\n token_updater=token_saver,\n)\nclient = PCOClient(credentials=credentials)\nperson = client.person.get(\"personid\")\n```\n\nNOTE: The client is a singleton. You only need to initialize it once with an `http_client` or `credentials` from then on you can call `PCOClient()` to return the already configured client.\n\nThe client also takes care of checking token expirations and will automatically refresh it using the refresh token in the credentials. After refreshing the token it will pass the new token to the function passed into the token_updater property so it can be saved if needed.\n\n\n# Contributing\n## Cutting a version\n\nThis repo contains semantic-release as a dev dependency. Review the changelog and ensure version notes are up to date (or that all commits in release have correct commit semantics).\n\nCut a new patch version.\n```bash\nbin/new-patch-version.sh\n```\n\n",
"bugtrack_url": null,
"license": "GNU GPLv3",
"summary": "Python wrappers for interacting with the Planning Center Online APIs",
"version": "0.0.7",
"project_urls": {
"Repository": "https://github.com/andy-goellner/pco-python-sdk"
},
"split_keywords": [
"sdk",
" planning center online"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "9c7d24022438c0236908a31071b8428e1bad7fa938d69557eb2ce79272de0825",
"md5": "8aa2ac3178ed912d63c75b2bb5c8434d",
"sha256": "702418a39bb23cbcbc250fd74a6583cf210ba4e2b2fbcf442a51d408663859c0"
},
"downloads": -1,
"filename": "planning_center_python-0.0.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8aa2ac3178ed912d63c75b2bb5c8434d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.10",
"size": 29850,
"upload_time": "2025-02-09T04:34:56",
"upload_time_iso_8601": "2025-02-09T04:34:56.883076Z",
"url": "https://files.pythonhosted.org/packages/9c/7d/24022438c0236908a31071b8428e1bad7fa938d69557eb2ce79272de0825/planning_center_python-0.0.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "400ef822bb0ccf1fd7b3c3de734fe34d38927c1edc25d206862488da6a2346c4",
"md5": "4e5bb88fe9d1e55fc513a5b3b443c3ac",
"sha256": "ee6fb2376d36f47dd35e9b8634a223a0f1b62ac554de9fdd7e55d9a1ab96d645"
},
"downloads": -1,
"filename": "planning_center_python-0.0.7.tar.gz",
"has_sig": false,
"md5_digest": "4e5bb88fe9d1e55fc513a5b3b443c3ac",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.10",
"size": 23409,
"upload_time": "2025-02-09T04:34:59",
"upload_time_iso_8601": "2025-02-09T04:34:59.036485Z",
"url": "https://files.pythonhosted.org/packages/40/0e/f822bb0ccf1fd7b3c3de734fe34d38927c1edc25d206862488da6a2346c4/planning_center_python-0.0.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-09 04:34:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "andy-goellner",
"github_project": "pco-python-sdk",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "planning-center-python"
}