afnio.tellurio.client#
Functions
Loads the username from a JSON configuration file. |
|
|
Saves the username to a JSON configuration file. |
Classes
|
A client for interacting with the Tellurio backend. |
Exceptions
Exception raised when the API key is invalid. |
- exception afnio.tellurio.client.InvalidAPIKeyError[source]#
Bases:
ExceptionException raised when the API key is invalid.
- add_note()#
Exception.add_note(note) – add a note to the exception
- args#
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- class afnio.tellurio.client.TellurioClient(base_url=None, port=None)[source]#
Bases:
objectA client for interacting with the Tellurio backend.
This client provides methods for authenticating with the backend, making HTTP requests (GET, POST, DELETE), and verifying API keys. It is designed to simplify communication with the Tellurio platform.
- delete(endpoint)[source]#
Makes a DELETE request to the specified endpoint.
- Parameters:
endpoint (str) – The API endpoint (relative to the base URL).
- Returns:
The HTTP response object.
- Return type:
httpx.Response
- get(endpoint)[source]#
Makes a GET request to the specified endpoint.
- Parameters:
endpoint (str) – The API endpoint (relative to the base URL).
- Returns:
The HTTP response object.
- Return type:
httpx.Response
- login(api_key=None, relogin=False)[source]#
Logs in the user using an API key and verifies its validity.
Credential resolution order:
If
api_keyis provided, it is used.- Otherwise, if the
TELLURIO_API_KEYenvironment variable is set, it is used.
- Otherwise, if the
- Otherwise, if not relogin, attempts to load a stored API key from
the keyring.
If authentication succeeds and the API key was provided directly (not via keyring), it is stored in the keyring for future use.
- Parameters:
- Returns:
A dictionary containing the user’s email and username.
- Return type:
- Raises:
ValueError – If the API key is invalid or not provided during re-login.