Skip to main content

Cacophony Project REST API client for Python

Project description

Cacophony Project API Client for Python

Python client for the Cacophony REST API.


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
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>,

Alternatively, using credentials stored in a configuration file:

from cacophonyapi.user import UserAPI
from cacophonyapi.config import Config


cp_client = UserAPI(config.api_url,
                            username=config.admin_username ,

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.


#TODO: expand testing in both and

Testing uses the pythony unittest framework where by both unit and integration testing is done.

test\ 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

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for cacophonyapi, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size cacophonyapi-0.0.1-py2.py3-none-any.whl (20.0 kB) File type Wheel Python version py2.py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page