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
inherits the value set by the previous context manager, defaulting to an environment variable (see below) if supported by that parameter. Parameters set to the empty string are not to be used in requests (with no default either).If the subscriber requires authorization for requests, you may either provide auth_token (which you should have obtained previously from the subscriber), or both username and password to get that token by first logging in to the subscriber. The token will be reused until explicitly reset or requested again in a latter context manager invocation.
Please note that this manager is reentrant but not concurrency-safe.
- Parameters:
urlbase¶ (str | None) – A URL base that will be used when an individual C2Array instance has no subscriber URL base set. Use the
BLOSC_C2URLBASE
environment variable if set as a last resort default.username¶ (str | None) – A name to be used in credentials to login to the subscriber and get an authorization token from it. Use the
BLOSC_C2USERNAME
environment variable if set as a last resort default.password¶ (str | None) – A secret to be used in credentials to login to the subscriber and get an authorization token from it. Use the
BLOSC_C2PASSWORD
environment variable if set as a last resort default.auth_token¶ (str | None) – A token that will be used when an individual C2Array instance has no authorization token set.
- Yields:
out (None)