Skip to content

Client

The aggregator SignTrakerClient is the primary entry point. It lazily creates and caches one sub-client per resource group. All sub-clients subclass BaseClient, which owns the HTTP transport.

signtraker.client.SignTrakerClient

SignTrakerClient(api_key: Optional[str] = None, base_url: Optional[str] = None, *, subdomain: Optional[str] = None, load_dotenv: bool = False, timeout_seconds: Optional[float] = None, max_retries: Optional[int] = None, retry_backoff_seconds: Optional[float] = None)

Primary entry point exposing all SignTraker resource groups.

Each resource group is exposed as a lazily instantiated, cached property. The base URL is tenant-specific, so provide either base_url or subdomain (or set SIGNTRAKER_BASE_URL / SIGNTRAKER_SUBDOMAIN).

Example
from signtraker import SignTrakerClient

client = SignTrakerClient(subdomain="theperrygroup")  # reads SIGNTRAKER_API_KEY
agents = client.agents.list_agents(top=5, orderby="LastName")
agent = client.agents.get_agent(123)

Initialize the aggregator client.

Parameters:

Name Type Description Default
api_key Optional[str]

API key; falls back to the SIGNTRAKER_API_KEY env var.

None
base_url Optional[str]

Full API base URL (e.g. "https://acme.signtraker.com"). Overrides subdomain.

None
subdomain Optional[str]

Tenant subdomain used to build the base URL when base_url is not provided.

None
load_dotenv bool

Opt-in load of a .env file via python-dotenv.

False
timeout_seconds Optional[float]

Default timeout propagated to all sub-clients.

None
max_retries Optional[int]

Retry attempts propagated to all sub-clients.

None
retry_backoff_seconds Optional[float]

Backoff propagated to all sub-clients.

None

Raises:

Type Description
ImportError

If load_dotenv is True but python-dotenv is not installed.

Source code in signtraker/client.py
def __init__(
    self,
    api_key: Optional[str] = None,
    base_url: Optional[str] = None,
    *,
    subdomain: Optional[str] = None,
    load_dotenv: bool = False,
    timeout_seconds: Optional[float] = None,
    max_retries: Optional[int] = None,
    retry_backoff_seconds: Optional[float] = None,
) -> None:
    """Initialize the aggregator client.

    Args:
        api_key: API key; falls back to the ``SIGNTRAKER_API_KEY`` env var.
        base_url: Full API base URL (e.g.
            ``"https://acme.signtraker.com"``). Overrides ``subdomain``.
        subdomain: Tenant subdomain used to build the base URL when
            ``base_url`` is not provided.
        load_dotenv: Opt-in load of a ``.env`` file via ``python-dotenv``.
        timeout_seconds: Default timeout propagated to all sub-clients.
        max_retries: Retry attempts propagated to all sub-clients.
        retry_backoff_seconds: Backoff propagated to all sub-clients.

    Raises:
        ImportError: If ``load_dotenv`` is True but ``python-dotenv`` is not
            installed.
    """
    if load_dotenv:
        from dotenv import load_dotenv as _load_dotenv

        _load_dotenv()
    self._api_key = api_key
    self._base_url = base_url
    self._subdomain = subdomain
    self._timeout_seconds = timeout_seconds
    self._max_retries = max_retries
    self._retry_backoff_seconds = retry_backoff_seconds

    self._agents: Optional[AgentsClient] = None
    self._change_orders: Optional[ChangeOrdersClient] = None
    self._credits: Optional[CreditsClient] = None
    self._enterprises: Optional[EnterprisesClient] = None
    self._offices: Optional[OfficesClient] = None
    self._order_presets: Optional[OrderPresetsClient] = None
    self._orders: Optional[OrdersClient] = None
    self._services: Optional[ServicesClient] = None

agents property

agents: AgentsClient

Access the agents endpoints.

change_orders property

change_orders: ChangeOrdersClient

Access the change-orders endpoints.

credits property

credits: CreditsClient

Access the credits endpoints.

enterprises property

enterprises: EnterprisesClient

Access the enterprises endpoints.

offices property

offices: OfficesClient

Access the offices endpoints.

order_presets property

order_presets: OrderPresetsClient

Access the order-presets endpoints.

orders property

orders: OrdersClient

Access the signage-orders endpoints.

services property

services: ServicesClient

Access the service-orders endpoints.

signtraker.base_client.BaseClient

BaseClient(api_key: Optional[str] = None, base_url: Optional[str] = None, *, subdomain: Optional[str] = None, timeout_seconds: Optional[float] = None, max_retries: Optional[int] = None, retry_backoff_seconds: Optional[float] = None)

Base client with shared request/response handling.

Resolves authentication and the tenant-specific base URL, then exposes thin HTTP verb helpers used by every resource client.

Initialize the base client.

The base URL is resolved from the first available of: base_url, subdomain (expanded to https://{subdomain}.signtraker.com), the SIGNTRAKER_BASE_URL env var, or the SIGNTRAKER_SUBDOMAIN env var.

Parameters:

Name Type Description Default
api_key Optional[str]

API key. Falls back to the SIGNTRAKER_API_KEY env var.

None
base_url Optional[str]

Full API base URL (e.g. "https://acme.signtraker.com"). Overrides subdomain.

None
subdomain Optional[str]

Tenant subdomain used to build the base URL when base_url is not provided.

None
timeout_seconds Optional[float]

Per-request timeout. Falls back to env/default.

None
max_retries Optional[int]

Retry attempts for transient failures.

None
retry_backoff_seconds Optional[float]

Base backoff between retries (exponential).

None

Raises:

Type Description
AuthenticationError

If no API key can be resolved.

SignTrakerConfigError

If no base URL or subdomain can be resolved.

Source code in signtraker/base_client.py
def __init__(
    self,
    api_key: Optional[str] = None,
    base_url: Optional[str] = None,
    *,
    subdomain: Optional[str] = None,
    timeout_seconds: Optional[float] = None,
    max_retries: Optional[int] = None,
    retry_backoff_seconds: Optional[float] = None,
) -> None:
    """Initialize the base client.

    The base URL is resolved from the first available of: ``base_url``,
    ``subdomain`` (expanded to ``https://{subdomain}.signtraker.com``), the
    ``SIGNTRAKER_BASE_URL`` env var, or the ``SIGNTRAKER_SUBDOMAIN`` env var.

    Args:
        api_key: API key. Falls back to the ``SIGNTRAKER_API_KEY`` env var.
        base_url: Full API base URL (e.g.
            ``"https://acme.signtraker.com"``). Overrides ``subdomain``.
        subdomain: Tenant subdomain used to build the base URL when
            ``base_url`` is not provided.
        timeout_seconds: Per-request timeout. Falls back to env/default.
        max_retries: Retry attempts for transient failures.
        retry_backoff_seconds: Base backoff between retries (exponential).

    Raises:
        AuthenticationError: If no API key can be resolved.
        SignTrakerConfigError: If no base URL or subdomain can be resolved.
    """
    self.api_key = api_key or _getenv_with_alias(ENV_API_KEY, ENV_API_KEY_ALT)
    if not self.api_key:
        raise AuthenticationError(
            "API key is required. Set SIGNTRAKER_API_KEY or pass api_key."
        )
    self.base_url = self._resolve_base_url(base_url, subdomain)
    self.timeout_seconds = (
        float(timeout_seconds)
        if timeout_seconds is not None
        else _parse_env_float(ENV_TIMEOUT_SECONDS, DEFAULT_TIMEOUT_SECONDS)
    )
    self.max_retries = (
        int(max_retries)
        if max_retries is not None
        else _parse_env_int(ENV_MAX_RETRIES, DEFAULT_MAX_RETRIES)
    )
    self.retry_backoff_seconds = (
        float(retry_backoff_seconds)
        if retry_backoff_seconds is not None
        else _parse_env_float(
            ENV_RETRY_BACKOFF_SECONDS, DEFAULT_RETRY_BACKOFF_SECONDS
        )
    )
    self.session = requests.Session()
    self.session.headers.update(
        {
            "Authorization": f"ST-API {self.api_key}",
            "Content-Type": "application/json",
            "Accept": "application/json",
        }
    )

get

get(endpoint: str, params: Optional[Dict[str, Any]] = None, *, timeout_seconds: Optional[float] = None) -> Any

Make a GET request.

Parameters:

Name Type Description Default
endpoint str

Path relative to the base URL.

required
params Optional[Dict[str, Any]]

Query-string parameters.

None
timeout_seconds Optional[float]

Per-request timeout override.

None

Returns:

Type Description
Any

The parsed response payload.

Source code in signtraker/base_client.py
def get(
    self,
    endpoint: str,
    params: Optional[Dict[str, Any]] = None,
    *,
    timeout_seconds: Optional[float] = None,
) -> Any:
    """Make a ``GET`` request.

    Args:
        endpoint: Path relative to the base URL.
        params: Query-string parameters.
        timeout_seconds: Per-request timeout override.

    Returns:
        The parsed response payload.
    """
    return self._request(
        "GET", endpoint, params=params, timeout_seconds=timeout_seconds
    )

post

post(endpoint: str, *, json_data: Optional[Union[Dict[str, Any], List[Any]]] = None, params: Optional[Dict[str, Any]] = None, timeout_seconds: Optional[float] = None) -> Any

Make a POST request.

Parameters:

Name Type Description Default
endpoint str

Path relative to the base URL.

required
json_data Optional[Union[Dict[str, Any], List[Any]]]

JSON-serializable request body.

None
params Optional[Dict[str, Any]]

Query-string parameters.

None
timeout_seconds Optional[float]

Per-request timeout override.

None

Returns:

Type Description
Any

The parsed response payload.

Source code in signtraker/base_client.py
def post(
    self,
    endpoint: str,
    *,
    json_data: Optional[Union[Dict[str, Any], List[Any]]] = None,
    params: Optional[Dict[str, Any]] = None,
    timeout_seconds: Optional[float] = None,
) -> Any:
    """Make a ``POST`` request.

    Args:
        endpoint: Path relative to the base URL.
        json_data: JSON-serializable request body.
        params: Query-string parameters.
        timeout_seconds: Per-request timeout override.

    Returns:
        The parsed response payload.
    """
    return self._request(
        "POST",
        endpoint,
        json_data=json_data,
        params=params,
        timeout_seconds=timeout_seconds,
    )

put

put(endpoint: str, *, json_data: Optional[Union[Dict[str, Any], List[Any]]] = None, params: Optional[Dict[str, Any]] = None, timeout_seconds: Optional[float] = None) -> Any

Make a PUT request.

Parameters:

Name Type Description Default
endpoint str

Path relative to the base URL.

required
json_data Optional[Union[Dict[str, Any], List[Any]]]

JSON-serializable request body.

None
params Optional[Dict[str, Any]]

Query-string parameters.

None
timeout_seconds Optional[float]

Per-request timeout override.

None

Returns:

Type Description
Any

The parsed response payload.

Source code in signtraker/base_client.py
def put(
    self,
    endpoint: str,
    *,
    json_data: Optional[Union[Dict[str, Any], List[Any]]] = None,
    params: Optional[Dict[str, Any]] = None,
    timeout_seconds: Optional[float] = None,
) -> Any:
    """Make a ``PUT`` request.

    Args:
        endpoint: Path relative to the base URL.
        json_data: JSON-serializable request body.
        params: Query-string parameters.
        timeout_seconds: Per-request timeout override.

    Returns:
        The parsed response payload.
    """
    return self._request(
        "PUT",
        endpoint,
        json_data=json_data,
        params=params,
        timeout_seconds=timeout_seconds,
    )

patch

patch(endpoint: str, *, json_data: Optional[Union[Dict[str, Any], List[Any]]] = None, params: Optional[Dict[str, Any]] = None, content_type: Optional[str] = None, timeout_seconds: Optional[float] = None) -> Any

Make a PATCH request.

Parameters:

Name Type Description Default
endpoint str

Path relative to the base URL.

required
json_data Optional[Union[Dict[str, Any], List[Any]]]

JSON-serializable request body.

None
params Optional[Dict[str, Any]]

Query-string parameters.

None
content_type Optional[str]

Optional Content-Type override (e.g. "application/merge-patch+json" for JSON Merge Patch).

None
timeout_seconds Optional[float]

Per-request timeout override.

None

Returns:

Type Description
Any

The parsed response payload.

Source code in signtraker/base_client.py
def patch(
    self,
    endpoint: str,
    *,
    json_data: Optional[Union[Dict[str, Any], List[Any]]] = None,
    params: Optional[Dict[str, Any]] = None,
    content_type: Optional[str] = None,
    timeout_seconds: Optional[float] = None,
) -> Any:
    """Make a ``PATCH`` request.

    Args:
        endpoint: Path relative to the base URL.
        json_data: JSON-serializable request body.
        params: Query-string parameters.
        content_type: Optional ``Content-Type`` override (e.g.
            ``"application/merge-patch+json"`` for JSON Merge Patch).
        timeout_seconds: Per-request timeout override.

    Returns:
        The parsed response payload.
    """
    headers = {"Content-Type": content_type} if content_type is not None else None
    return self._request(
        "PATCH",
        endpoint,
        json_data=json_data,
        params=params,
        headers=headers,
        timeout_seconds=timeout_seconds,
    )

delete

delete(endpoint: str, *, params: Optional[Dict[str, Any]] = None, timeout_seconds: Optional[float] = None) -> Any

Make a DELETE request.

Parameters:

Name Type Description Default
endpoint str

Path relative to the base URL.

required
params Optional[Dict[str, Any]]

Query-string parameters.

None
timeout_seconds Optional[float]

Per-request timeout override.

None

Returns:

Type Description
Any

The parsed response payload.

Source code in signtraker/base_client.py
def delete(
    self,
    endpoint: str,
    *,
    params: Optional[Dict[str, Any]] = None,
    timeout_seconds: Optional[float] = None,
) -> Any:
    """Make a ``DELETE`` request.

    Args:
        endpoint: Path relative to the base URL.
        params: Query-string parameters.
        timeout_seconds: Per-request timeout override.

    Returns:
        The parsed response payload.
    """
    return self._request(
        "DELETE", endpoint, params=params, timeout_seconds=timeout_seconds
    )