Credential

class acouchbase_columnar.credential.Credential(**kwargs: str)

Create a Credential instance.

A Credential is required in order to connect to a Capalla Columnar server.

Important

Use the the provided classmethods to create a Credential instance.

classmethod from_username_and_password(username: str, password: str)

Create a Credential from a username and password.

Parameters:
  • username (str) – The username for the Capalla Columnar cluster.

  • password (str) – The password for the Capalla Columnar cluster.

Return type:

Credential

Returns:

A Credential instance.

classmethod from_callable(callback: Callable[[], Credential])

Create a Credential from provided callback.

The callback is

Parameters:

callback (Callable[[], Credential]) – Callback that returns a Credential.

Return type:

Credential

Returns:

A Credential instance.

Example

Retrieve credentials from environment variables:

def _cred_from_env() -> Credential:
    from os import getenv
    return Credential.from_username_and_password(getenv('PYCBCC_USERNAME'),
                                                 getenv('PYCBCC_PW'))

cred = Credential.from_callable(_cred_from_env)