Skip to content

Client

Manages a connection to an ODK Central server.

Handles authentication, and provides access to Central functionality through methods organized by the Central resource they are most related to.

project_id property writable

Get the default project_id.

__enter__()

Enter the session, and authenticate.

__exit__(*args)

Close the session.

This only cleans up the Session, it does not invoke logout from Central.

__init__(config_path=None, cache_path=None, project_id=None, session=None, api_version='v1', config=None)

Create a new Client.

Parameters:

Name Type Description Default
config_path str | Path | None

Where to read the pyodk_config.toml. Defaults to the path in PYODK_CONFIG_FILE, then the user home directory.

None
cache_path str | Path | None

Where to read/write pyodk_cache.toml. Defaults to the path in PYODK_CACHE_FILE, then the user home directory.

None
project_id int | None

The project ID to use for all client calls. Defaults to the "default_project_id" in pyodk_config.toml, or can be specified per call.

None
session Session | None

A prepared pyodk.session.Session class instance, or an instance of a customised subclass.

None
config Config | None

A Config object containing details from pyodk_config.toml.

None
api_version str | None

The ODK Central API version, which is used in the URL path e.g. 'v1' in 'https://www.example.com/v1/projects'.

'v1'

close(*args)

Close the session.

This only cleans up the Session, it does not invoke logout from Central.

open()

Enter the session, and authenticate.