Configuration
Configure the listingsAPI Python client: API key, base URL, timeout, retries, and logging.
Constructor signature
listingsapi.ListingsAPI(
api_key: str | None = None,
*,
base_url: str | None = None,
timeout: float = 240.0,
max_retries: int = 2,
)
All arguments are optional. If api_key is omitted the client reads
LISTINGSAPI_KEY from the environment and raises AuthenticationError
at construction time if neither is set.
Options
| Option | Type | Default | Description |
|---|---|---|---|
api_key | str | None | None | API key. Falls back to the LISTINGSAPI_KEY environment variable. |
base_url | str | None | https://listingsapi.com | API origin. A trailing slash is stripped automatically. |
timeout | float | 240.0 | Per-request timeout in seconds (applies to each HTTP request individually). |
max_retries | int | 2 | Automatic retries on 429 and 5xx responses. Set to 0 to disable. |
API key
export LISTINGSAPI_KEY="your-api-key"import listingsapi # From environment (recommended)client = listingsapi.ListingsAPI() # Explicit keyclient = listingsapi.ListingsAPI(api_key="your-api-key")Timeout
Default is 240.0 seconds. For short-lived scripts or interactive use you
may want a tighter value:
client = listingsapi.ListingsAPI(timeout=30.0)The timeout applies to each individual HTTP request. Bulk pagination calls
(auto_paging_iter) respect the per-request timeout independently.
Retries
The SDK mounts a urllib3 Retry adapter on its requests session that
automatically retries 429, 500, 502, 503, and 504 responses for
GET and POST methods. The default is 2 retries with a 0.5-second
exponential backoff factor. Retry-After headers are honoured, so a 429
that names a wait time is retried after exactly that long.
# More aggressive retry for long-running batch jobsclient = listingsapi.ListingsAPI(max_retries=5) # Disable retries entirely (e.g. when you want fast failures)client = listingsapi.ListingsAPI(max_retries=0)A 429 that survives every retry surfaces as RateLimitError; see
Error handling for a manual backoff recipe.
Base URL override
Useful for staging environments or internal proxies:
client = listingsapi.ListingsAPI(base_url="https://staging.example.com")The trailing slash is stripped automatically. All requests are made under
the /api/v4/ path on this origin.
Logging
The SDK logs through the standard logging module under the listingsapi
logger. At DEBUG level it records the method and URL of every request
(and query parameters for GET); request bodies and your API key are never
logged.
import logginglogging.basicConfig()logging.getLogger("listingsapi").setLevel(logging.DEBUG) import listingsapiclient = listingsapi.ListingsAPI()client.locations.list(first=1)Next steps
- Quickstart: your first API call
- Error handling: exception types and retry guidance