↓ Skip to main content
All methods

stakepd.kalshi_data.KalshiAPIError

Exception
Exception class
kd.KalshiAPIError

Raised when Kalshi returns an HTTP error.

For example, 404 for an unknown market or 401 for a bad key. Rate-limit (429) and server (5xx) errors are first retried automatically with exponential backoff, up to max_retries times. Inherits from KalshiError.

Attributes

AttributeTypeDescription
status_codeintHTTP status code
codeKalshi’s error code
messagestrKalshi’s error message
detailsExtra details from Kalshi, if any
urlstrThe URL that was requested

See also

KalshiClient.get_market
Get one market.
KalshiError
Base class for every exception raised by stakepd.kalshi_data.

Examples
#

Example:

try:
    m = client.get_market("NOT-A-REAL-TICKER")
except kd.KalshiAPIError as e:
    print(e.status_code, e.code, e.message)

This method is also covered, alongside the rest of the module, in the overview guide.