OBM 4 Auth Notebook¶
API quick reference¶
This notebook focuses on credential loading and token retrieval in different runtimes. Most-used elements:
Credentials()Credentials.atokenCredentials.tokenCredentials.api_keyIS_BROWSER_RUNTIME
For the complete reference, see API Reference. For how credentials are resolved, applied, and what degrades when they are missing, see Credentials.
API methods used in this notebook¶
- class here_search_demo.auth.Credentials
Credential and token provider for HERE API requests.
The class resolves credentials from environment variables and/or local credentials files, then exposes either an API key or OAuth access token. Token values are cached and refreshed before expiration.
Environment variable precedence for API key:
HERE_ACCESS_KEY_ID+HERE_ACCESS_KEY_SECRET>HERE_API_KEY>API_KEY.- Variables:
default_auth_url (str) – Default OAuth token endpoint.
- property atoken: dict
Return an OAuth access token using the async transport.
This path is intended for browser runtimes (Pyodide/JupyterLite). The token is cached in memory and refreshed when close to expiry.
- Returns:
OAuth access token, or
Nonewhen OAuth credentials are unavailable.- Return type:
str | None
- property token: str | None
Return an OAuth access token using the synchronous transport.
This path is intended for standard CPython runtimes. The token is cached in memory and refreshed when close to expiry.
- Returns:
OAuth access token, or
Nonewhen OAuth credentials are unavailable.- Return type:
str | None
- here_search_demo.http.IS_BROWSER_RUNTIME = False
bool(x) -> bool
Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.