TimeoutConfig

Classin timeoutfastly-compute 0.1.3View source

Timeout configuration for Fastly backend requests.

Fastly supports three distinct timeout phases:

  • connect_timeout: Time to establish the initial TCP connection
  • firstbytetimeout: Time between sending request and receiving first response byte
  • betweenbytestimeout: Maximum time between any two consecutive bytes in response

This provides much more granular control than the standard requests library, which only supports a single timeout or (connect, read) tuple.

Constructor

TimeoutConfig(connect: float = 30.0, first_byte: float = 60.0, between_bytes: float = 10.0)

Initialize timeout configuration.

Parameters

connect: floatoptional = 30.0

Connection timeout in seconds (default: 30.0)

first_byte: floatoptional = 60.0

First byte timeout in seconds (default: 60.0)

between_bytes: floatoptional = 10.0

Between bytes timeout in seconds (default: 10.0)

Properties

connect_ms

intread-onlyView source

Connection timeout in milliseconds (for WIT API).

first_byte_ms

intread-onlyView source

First byte timeout in milliseconds (for WIT API).

between_bytes_ms

intread-onlyView source

Between bytes timeout in milliseconds (for WIT API).

connect

floatView source

first_byte

floatView source

between_bytes

floatView source

Methods

__repr__

View source
__repr__() -> str

Return string representation of TimeoutConfig.

Returns

str

from_requests_timeout

staticView source
from_requests_timeout(timeout: None | float | tuple[float, float]) -> Self

Create TimeoutConfig from requests-compatible timeout parameter.

Parameters

timeout: None | float | tuple[float, float]

Timeout specification in requests-compatible formats:

  • None: Use default timeouts
  • float: Single timeout applied to all phases
  • (connect, read): Tuple with separate connect and read timeouts

Returns

Self

TimeoutConfig object with appropriate timeout values

Throws