deepint.auth

class deepint.auth.Credentials(token: str, instance: str = 'app.deepint.net')

Loads credentials (token), and manages it during runtime.

This class must not be instantiated directly, but the deepint_sdk.auth.Credentials.build method must be used. Due to this fact, for details on how to provide the access token, see the deepint_sdk.auth.Credentials.build method.

token

Token to access the deepint.net API that must be used to authenticate each transaction.

instance

Host to connect with. By default is the hostname of the SaaS instance, however if you are working with an on-premise instance, this must be specified.

classmethod build(token: Optional[str] = None, instance: str = 'app.deepint.net') Credentials

Instances a deepint_sdk.auth.Credentials with one of the provided methods.

The priority of credentials loading is the following:
  • if the credentials are provided as a parameter, this one is used.

  • then the credentials are tried to be extracted from the environment variable `DEEPINT_TOKEN` and `DEEPINT_INSTANCE`.

  • then the credentials are tried to be extracted from the file `~/.deepint.ini` located in the user’s directory.

If the token is not provided in any of these ways, an deepint_sdk.error.DeepintCredentialsError will be thrown.

Example

[DEFAULT] token=a token instance=host to connect with (if not providen app.deepint.net will be taken by default)

Parameters:
  • token – Token to access the deepint.net API that must be used to authenticate each transaction.

  • instance – Host to connect with. By default is the hostname of the SaaS instance, however if you are working with an on-premise instance, this must be specified.

Returns:

An instanced credentials object.

update_credentials(token: str, instance: str) None

Updates the token value.

Alternative of updating directly the token value accessing the attribute deepint_sdk.auth.Credentials.token.

Parameters:
  • token – token to replace current token stored in deepint_sdk.auth.Credentials.token.

  • instance – Host to connect with. By default is the hostname of the SaaS instance, however if you are working with an on-premise instance, this must be specified.