Skip to content

client_factory

The client factory module is responsible for creating a client instance.

logger = logging.getLogger(__name__) #

ClientFactory(api_key: str, api_url: str) #

Client factory class.

Source code in src/xpdeep/client_factory.py
def __init__(self, api_key: str, api_url: str) -> None:
    self.api_key = api_key
    self.api_url = api_url

CURRENT: ContextVar[ClientFactory] = ContextVar('CURRENT_CLIENT_FACTORY') #

api_key = api_key #

api_url = api_url #

__call__() -> AuthenticatedClient #

Return an authenticated client instance.

Source code in src/xpdeep/client_factory.py
def __call__(self) -> AuthenticatedClient:
    """Return an authenticated client instance."""
    return AuthenticatedClient(
        base_url=self.api_url,
        token=self.api_key,
        prefix="Basic",
        raise_on_unexpected_status=True,
    )