Python SDK

Python client for the dscr.ai API with async support.

The official Python SDK provides both sync and async clients for the dscr.ai API.

Installation

pip install dscr-sdk

Quick Start

from dscr import DscrClient

client = DscrClient(api_key="your-api-key")

deals = client.deals.list()
for deal in deals.data:
    print(f"{deal.id}: {deal.property_address}")

Configuration

PropertyTypeDescription
api_keyrequiredstrYour dscr.ai API key (starts with sk_live_ or sk_test_)
base_urlstrOverride the API base URL. Defaults to https://pricingengine.pro
timeoutfloatRequest timeout in seconds. Default: 30.0
max_retriesintMax automatic retries on 5xx errors. Default: 2
client = DscrClient(
    api_key="sk_live_...",
    base_url="https://pricingengine.pro",
    timeout=15.0,
    max_retries=3,
)

Available Methods

Error Handling

from dscr import DscrClient, DscrError

try:
    deal = client.deals.get("deal_invalid")
except DscrError as e:
    print(f"Error {e.code}: {e.message}")
    if e.code == "NOT_FOUND":
        print("Deal does not exist")

Tip

The SDK automatically retries on 500 and 503 errors with exponential backoff. Configure max_retries to control retry behavior.