Credential
- class acouchbase_analytics.credential.Credential(**kwargs: str)
Create a Credential instance.
A Credential is required in order to connect to a Analytics endpoint.
Important
Use the the provided classmethods to create a
Credentialinstance.- classmethod from_username_and_password(username: str, password: str)
Create a
Credentialfrom a username and password.- Parameters:
- Return type:
- Returns:
A Credential instance.
- classmethod from_callable(callback: Callable[[], Credential])
Create a
Credentialfrom provided callback.The callback is
- Parameters:
callback (
Callable[[],Credential]) – Callback that returns aCredential.- Return type:
- 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)