modlee.api_config module

class modlee.api_config.ModleeAPIConfig[source]

Bases: object

Singleton class to manage API configuration and client initialization for Modlee. Ensures that only one instance of the configuration exists and handles API key validation and client setup.

ensure_api_key()[source]

Ensures that the API key is set and matches the client’s API key. Logs warnings if the API key is not set or if there is a mismatch.

Returns:

True if the API key is set and matches the client’s API key, False otherwise.

get_client()[source]

Returns the Modlee client after ensuring that the API key is correctly set.

Returns:

The Modlee client.

reload_modules()[source]

Reloads the Modlee-related modules to ensure they are using the updated client.

set_api_key(api_key)[source]

Sets the API key for the Modlee configuration and updates the client. Reloads the modules to ensure they are using the updated client.

Parameters:

api_key – The new API key to be set.