Church of England CMS API Client
Project description
================================
Church of England CMS API Client
================================
.. image:: https://img.shields.io/pypi/v/pycofecms.svg
:target: https://pypi.python.org/pypi/pycofecms
.. image:: https://readthedocs.org/projects/pycofecms/badge/?version=latest
:target: https://pycofecms.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
Before you start, make sure you have access credentials for the Church of England CMS API. You will
need a valid `API_ID` and `API_KEY`. See https://cmsapi.cofeportal.org/security for more
information about this.
Most of the endpoints also require a `diocese_id`. You should be supplied with this when you
receive your access credentials.
* Free software: BSD license
* Documentation: https://pycofecms.readthedocs.io
Features
========
* Python client for the CofE CMS API (https://cmsapi.cofeportal.org/)
* Python 3.5
* 100% test coverage
Quick Start
===========
.. code-block:: python
>>> from cofecms import CofeCMS
>>> cofe = CofeCMS(API_ID, API_KEY, diocese_id)
>>> result = cofe.get_contacts(
limit=10,
fields={'contact': ['surname']},
search_params={'keyword': 'smith', 'keyword_names_only': 'on'},
)
>>> # This query has 82 total results.
>>> print(result.total_count)
82
>>> # Spread across 9 pages
>>> print(result.total_pages)
9
>>> # Get the data for the first page for the query
>>> print(result)
[{'surname': 'Aynsley-Smith'},
{'surname': 'Bradford-Smith'},
{'surname': 'Brothertonsmith'},
{'surname': 'Busen-Smith'},
{'surname': 'Cox-Smith'},
{'surname': 'Drummond Smith'},
{'surname': 'Goldsmith'},
{'surname': 'Grout-Smith'},
{'surname': 'Hall-Smith'},
{'surname': 'Harcourt-Smith'}]
>>> # Get a specific page for the query
>>> print(result.get_data_for_page(4))
[{'surname': 'Smith-Agent'},
{'surname': 'Smith-Cherry'},
{'surname': 'Smith-McSmithSmith'},
{'surname': 'Smith'},
{'surname': 'Smith'},
{'surname': 'Smith'},
{'surname': 'Smith'},
{'surname': 'Smith'},
{'surname': 'Smith'},
{'surname': 'Smith'}]
>>> # Loop through all available pages
>>> for page in result.pages_generator():
print(len(page))
10
10
10
10
10
10
10
9
0
>>> # Or retrieve all records for the query
>>> print(result.all())
[{'surname': 'Aynsley-Smith'},
{'surname': 'Bradford-Smith'},
{'surname': 'Brothertonsmith'},
{'surname': 'Busen-Smith'},
{'surname': 'Cox-Smith'},
{'surname': 'Drummond Smith'},
{'surname': 'Goldsmith'},
...
{'surname': 'Smith'},
{'surname': 'Smith'},
{'surname': 'Smith'},
{'surname': 'Smitherman'},
{'surname': 'Smithers'},
{'surname': 'Sutton-Smith'},
{'surname': 'Thistleton-Smith'}]
=======
History
=======
0.1.0 (2017-03-20)
------------------
* First release on PyPI.
Church of England CMS API Client
================================
.. image:: https://img.shields.io/pypi/v/pycofecms.svg
:target: https://pypi.python.org/pypi/pycofecms
.. image:: https://readthedocs.org/projects/pycofecms/badge/?version=latest
:target: https://pycofecms.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
Before you start, make sure you have access credentials for the Church of England CMS API. You will
need a valid `API_ID` and `API_KEY`. See https://cmsapi.cofeportal.org/security for more
information about this.
Most of the endpoints also require a `diocese_id`. You should be supplied with this when you
receive your access credentials.
* Free software: BSD license
* Documentation: https://pycofecms.readthedocs.io
Features
========
* Python client for the CofE CMS API (https://cmsapi.cofeportal.org/)
* Python 3.5
* 100% test coverage
Quick Start
===========
.. code-block:: python
>>> from cofecms import CofeCMS
>>> cofe = CofeCMS(API_ID, API_KEY, diocese_id)
>>> result = cofe.get_contacts(
limit=10,
fields={'contact': ['surname']},
search_params={'keyword': 'smith', 'keyword_names_only': 'on'},
)
>>> # This query has 82 total results.
>>> print(result.total_count)
82
>>> # Spread across 9 pages
>>> print(result.total_pages)
9
>>> # Get the data for the first page for the query
>>> print(result)
[{'surname': 'Aynsley-Smith'},
{'surname': 'Bradford-Smith'},
{'surname': 'Brothertonsmith'},
{'surname': 'Busen-Smith'},
{'surname': 'Cox-Smith'},
{'surname': 'Drummond Smith'},
{'surname': 'Goldsmith'},
{'surname': 'Grout-Smith'},
{'surname': 'Hall-Smith'},
{'surname': 'Harcourt-Smith'}]
>>> # Get a specific page for the query
>>> print(result.get_data_for_page(4))
[{'surname': 'Smith-Agent'},
{'surname': 'Smith-Cherry'},
{'surname': 'Smith-McSmithSmith'},
{'surname': 'Smith'},
{'surname': 'Smith'},
{'surname': 'Smith'},
{'surname': 'Smith'},
{'surname': 'Smith'},
{'surname': 'Smith'},
{'surname': 'Smith'}]
>>> # Loop through all available pages
>>> for page in result.pages_generator():
print(len(page))
10
10
10
10
10
10
10
9
0
>>> # Or retrieve all records for the query
>>> print(result.all())
[{'surname': 'Aynsley-Smith'},
{'surname': 'Bradford-Smith'},
{'surname': 'Brothertonsmith'},
{'surname': 'Busen-Smith'},
{'surname': 'Cox-Smith'},
{'surname': 'Drummond Smith'},
{'surname': 'Goldsmith'},
...
{'surname': 'Smith'},
{'surname': 'Smith'},
{'surname': 'Smith'},
{'surname': 'Smitherman'},
{'surname': 'Smithers'},
{'surname': 'Sutton-Smith'},
{'surname': 'Thistleton-Smith'}]
=======
History
=======
0.1.0 (2017-03-20)
------------------
* First release on PyPI.
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
pycofecms-0.1.1.tar.gz
(25.7 kB
view details)
Built Distribution
File details
Details for the file pycofecms-0.1.1.tar.gz
.
File metadata
- Download URL: pycofecms-0.1.1.tar.gz
- Upload date:
- Size: 25.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 503142ffc82774118b6222d94a6000eb3d29958225d60dff49cabdefe3ca9f1d |
|
MD5 | 27b5bcf569cd2cccae65223c9a15da08 |
|
BLAKE2b-256 | cab434c87545411a7e05d0da836076e8fe999681c2e4779aa72de2e8854d2539 |
File details
Details for the file pycofecms-0.1.1-py2.py3-none-any.whl
.
File metadata
- Download URL: pycofecms-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f1a18d355a569f6423d6db12468dc0a92c4f9b5afe0b85701d71813ad0bbd9e |
|
MD5 | 0642f6a39f5b39084ad5d0ed5f24bf92 |
|
BLAKE2b-256 | 0b6bb9d4fdf5ae5006425fb4ebb148321ff03739b370fc1271f4119e8c6b30f9 |