Skip to content

Token

cl_forge.settings.Token

Token(dotenv_path: str | None = None)

Represents API tokens used for authentication.

Tokens are loaded from environment variables or a .env file. System environment variables take precedence over .env file values.

Notes
  • Environment variables used:
    • CLFORGE_CMF_TOKEN: CMF token (API key).
    • CLFORGE_MARKET_TOKEN: Market token (ticket).

If dotenv_path is provided, it loads the .env file from that path. Otherwise, it looks for a .env file in the current or parent directories.

Parameters:

Name Type Description Default
dotenv_path str | None

Optional path to a .env file. Defaults to None.

None
Source code in src/cl_forge/core/impl/rs_cl_forge/rs_base.pyi
def __init__(self, dotenv_path: str | None = None) -> None:
    """
    Initializes a new Token instance.

    If ``dotenv_path`` is provided, it loads the .env file from that path.
    Otherwise, it looks for a .env file in the current or parent directories.

    Parameters
    ----------
    dotenv_path : str | None
        Optional path to a .env file. Defaults to None.
    """

cmf property

cmf: str | None

Returns the CMF token (API key), or None if not set.

Loaded from the CLFORGE_CMF_TOKEN environment variable. If the environment variable is missing or empty, this property returns None.

market property

market: str | None

Returns the Market token (ticket), or None if not set.

Loaded from the CLFORGE_MARKET_TOKEN environment variable. If the environment variable is missing or empty, this property returns None.