MartianClient

class martian_apart_hack_sdk.martian_client.MartianClient(api_url, api_key, org_id=None, httpx_client_factory=<class 'httpx.Client'>)[source]

The main client for the Martian SDK. Use the MartianClient to interact with the Judges and Routers Clients.

Parameters:
  • api_url (str) – The base URL for the Martian API.

  • api_key (str) – The API key to use for authentication.

  • org_id (Optional[str], optional) – The organization ID to use for authentication. If not provided, the organization ID will be fetched from the API.

  • httpx_client_factory (dataclasses.InitVar[type[httpx.Client]])

organization

Client for organization-specific operations like checking credits.

Type:

OrganizationClient

judges

Client for creating, updating, and managing judges.

Type:

JudgesClient

routers

Client for creating, updating, and managing routers.

Type:

RoutersClient

Notes

The MartianClient is a singleton. You should not create multiple instances of the MartianClient.

Parameters:
  • httpx_client_factory (InitVar)

  • api_url (str)

  • api_key (str)

  • org_id (str | None)

httpx_client_factory

alias of Client

Example Usage

from martian_apart_hack_sdk import MartianClient

# Create a client instance
client = MartianClient(
    api_url="https://api.martian.com",
    api_key="your-api-key",
    org_id="your-org-id"  # Optional - will be fetched from API if not provided
)

# Access the judges client
judges = client.judges

# Access the routers client
routers = client.routers

# Access organization features
balance = client.organization.get_credit_balance()