Cacophony Project API Client for Python
Python client for the Cacophony REST API.
Installation
This API client requires Python 3.6 or later. At present the library is not yet available on PyPI.
To install, create a virtualenv using your preferred method then:
git clone https://github.com/TheCacophonyProject/python-api.git
cd python-api
pip install .
If you plan on making changes to python-api, you'll want to install the test dependencies as well:
pip install -r .[test]
Using the package (User API)
Client setup
Open an instance of the client and use credentials directly
from cacophonyapi.user import UserAPI
client = UserAPI(baseurl=<SERVER-URL>,
username=<USER-NAME>,
password=<USER-PASSWORD>)
Alternatively, using credentials stored in a configuration file:
from cacophonyapi.user import UserAPI
from cacophonyapi.config import Config
config=Config().load_config(config_file=os.path.join(
os.getcwd(),'defaultconfig.json'))
cp_client = UserAPI(config.api_url,
username=config.admin_username ,
password=config.admin_password)
API calls
By default the most recent 100 recordings accessible to the user
account are queried but UserAPI.query() does support a number of
filtering options. The API server supports arbitrary queries so feel
free to extend UserAPI.query() if required.
Testing
#TODO: expand testing in both test_client_user_without_server.py and test_client_user_with_server.py
Testing uses the pythony unittest framework where by both unit and integration testing is done.
test\test_client_user_without_server.py is tests without requiring a server nose2 --verbosity 2 cacophonyapi.test.test_client_user_without_server
and test\test_client_user_with_server is full integration testing against a server. This is also part of the travis test nose2 --verbosity 2 CacophonyClient.test.test_client_user_with_server.
This integration testing does require a local server setup see travis.yml
For individual test nose2 --verbosity 2 cacophonyapi.test.test_client_user_with_server.mockedCacophonyServer.test_query
#TODO: Docs improve PEP257 compliance for cacophonyapi UserApi etc, don't know why it is not failing tox -e pep257
Metadata
Release files for cacophonyapi 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| cacophonyapi-0.0.5.tar.gz | 18.7 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cacophonyapi-0.0.5-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 39.0 kB
Release files / cacophonyapi-0.0.5.tar.gz
| Download URL | cacophonyapi-0.0.5.tar.gz |
|---|---|
| Size | 18.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b120a8561e8790f70fbf265455f7e897511219b283a066060667024afdc484c4
|
|
BLAKE2b-256 checksum How to use checksums |
30f42377a6202177fe7a56dc5eaf444ceb18964069cd3340acbe803300ba5c54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2025.
Transparency logRelease files / cacophonyapi-0.0.5-py2.py3-none-any.whl
| Download URL | cacophonyapi-0.0.5-py2.py3-none-any.whl |
|---|---|
| Size | 20.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
9c7555c7f24f7ad8fd98562815185902edbc91ca8db9bdcd89af5b924144b491
|
|
BLAKE2b-256 checksum How to use checksums |
4ce4ebeeca8130d383c175f30a229ae82c860b050dce68f6b73a0cc1e104280b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2025.
Transparency logSecurity for cacophonyapi 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for cacophonyapi-0.0.5.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.