ds_protocol_http_py_lib.utils.http.config ========================================= .. py:module:: ds_protocol_http_py_lib.utils.http.config .. autoapi-nested-parse:: **File:** ``config.py`` **Region:** ``ds_protocol_http_py_lib/utils/http/config`` Configuration for the HTTP client. .. rubric:: Example >>> config = HttpConfig(timeout_seconds=10, user_agent="MyUA/1.0") >>> retry = RetryConfig(total=3, backoff_factor=0.2, status_forcelist=(429, 500, 502, 503, 504)) >>> http = Http(config=config, retry=retry) >>> response = http.get("https://api.example.com/data") >>> data = response.json() Classes ------- .. autoapisummary:: ds_protocol_http_py_lib.utils.http.config.RetryConfig ds_protocol_http_py_lib.utils.http.config.HttpConfig Module Contents --------------- .. py:class:: RetryConfig Retry policy (urllib3 Retry via requests). - total: max attempts (includes first request) - backoff_factor: sleep = factor * (2 ** (retry_num - 1)) - status_forcelist: statuses that trigger retry - allowed_methods: methods eligible for retry - respect_retry_after_header: honor Retry-After on 429/503 .. py:attribute:: total :type: int :value: 3 .. py:attribute:: backoff_factor :type: float :value: 0.2 .. py:attribute:: status_forcelist :type: tuple[int, Ellipsis] :value: (429, 500, 502, 503, 504) .. py:attribute:: allowed_methods :type: tuple[str, Ellipsis] :value: ('GET', 'POST', 'PUT', 'DELETE', 'PATCH') .. py:attribute:: raise_on_status :type: bool :value: False .. py:attribute:: respect_retry_after_header :type: bool :value: True .. py:class:: HttpConfig Configuration for the HTTP client. - headers: applied to all requests (overridable per call) - timeout_seconds: connect+read timeout seconds (or (connect, read) per call) - user_agent: user agent for all requests - pool_maxsize: maximum number of connections in the pool - pool_connections: maximum number of connections in the pool - raise_for_status: raise for status for all requests - retry: RetryConfig .. py:attribute:: headers :type: collections.abc.Mapping[str, str] .. py:attribute:: timeout_seconds :type: int | float :value: 10 .. py:attribute:: user_agent :type: str :value: 'Http/1.0' .. py:attribute:: pool_maxsize :type: int :value: 32 .. py:attribute:: pool_connections :type: int :value: 10 .. py:attribute:: retry :type: RetryConfig