peyk.transport.errors

Transport-level exceptions.

These carry only transport-level facts (connection failure, timeout, HTTP status, rate-limit hint). No platform-specific error-body parsing happens here or anywhere in this project — that is deliberately deferred to future per-platform adapters that sit on top of peyk.

Exceptions

HTTPStatusError(message, *, status_code, body)

Raised for any non-2xx HTTP response other than 429.

NetworkError

Raised when the underlying connection fails.

RateLimitedError(message, *[, ...])

Raised when the server responds with HTTP 429 (Too Many Requests).

TimeoutError_

Raised when a request does not complete within its configured timeout.

TransportError

Base class for all errors raised by the transport layer.

exception peyk.transport.errors.TransportError[source]

Bases: Exception

Base class for all errors raised by the transport layer.

exception peyk.transport.errors.NetworkError[source]

Bases: TransportError

Raised when the underlying connection fails.

Covers DNS failure, connection refused, connection reset, and other transport-level connectivity problems that are not an HTTP response.

exception peyk.transport.errors.TimeoutError_[source]

Bases: TransportError

Raised when a request does not complete within its configured timeout.

Named with a trailing underscore to avoid shadowing the builtin TimeoutError.

exception peyk.transport.errors.RateLimitedError(message: str, *, retry_after_seconds: float | None = None)[source]

Bases: TransportError

Raised when the server responds with HTTP 429 (Too Many Requests).

Variables:

retry_after_seconds – The value of the response’s Retry-After header, parsed to seconds, if present and parseable. None if the header was absent or not parseable as a plain number of seconds.

exception peyk.transport.errors.HTTPStatusError(message: str, *, status_code: int, body: bytes)[source]

Bases: TransportError

Raised for any non-2xx HTTP response other than 429.

Variables:
  • status_code – The HTTP status code returned by the server.

  • body – The raw response body bytes (may be empty).