blosc2.c2context#
- blosc2.c2context(*, urlbase: str | None = None, username: str | None = None, password: str | None = None, auth_token: str | None = None) None #
Context manager that sets parameters in Caterva2 subscriber requests.
A parameter not specified or set to
None
will inherit the value from the previous context manager, defaulting to an environment variable (see below) if supported by that parameter. Parameters set to an empty string will not to be used in requests (with no default either).If the subscriber requires authorization for requests, you can either provide an auth_token (which you should have obtained previously from the subscriber), or both username and password to obtain the token by logging in to the subscriber. The token will be reused until it is explicitly reset or requested again in a subsequent context manager invocation.
Please note that this manager is reentrant but not safe for concurrent use.
- Parameters:
urlbase¶ (str | None) – The base URL to be used when a C2Array instance does not have a subscriber URL base set. If not specified, it defaults to the value of the
BLOSC_C2URLBASE
environment variable.username¶ (str | None) – The username for logging in to the subscriber to obtain an authorization token. If not specified, it defaults to the value of the
BLOSC_C2USERNAME
environment variable.password¶ (str | None) – The password for logging in to the subscriber to obtain an authorization token. If not specified, it defaults to the value of the
BLOSC_C2PASSWORD
environment variable.auth_token¶ (str | None) – The authorization token to be used when a C2Array instance does not have an authorization token set.
- Yields:
out (None)