Skip to main content

cdse.CDSEAuth

CDSE authentication handler using OpenIDConnect bearer tokens.

Usage

Source

cdse.CDSEAuth(
    username=None,
    password=None,
)

Automatically refreshes access tokens when expired.

Parameters

username: str | None = None

CDSE username used to request the initial token. If not provided, falls back to the CDSE_USERNAME environment variable.

password: str | None = None
CDSE password used to request the initial token. If not provided, falls back to the CDSE_PASSWORD environment variable.

Raises

ConfigurationError

If credentials are not provided as arguments and not found in the environment, or if CDSE rejects them (HTTP 400, 401 or 403).

requests.RequestException
If the token request fails otherwise. The error keeps neither the request nor the response, so that the password does not travel with it.

Methods

Name Description
__call__() Attach the current access token to the given HTTP request.

__call__()

Attach the current access token to the given HTTP request.

Usage

Source

__call__(r)
Parameters
r: PreparedRequest
The request object to modify.
Returns
requests.PreparedRequest
The modified request with the Authorization header set.