Skip to content

Commit b51d3d3

Browse files
committed
docs: Document the send_request transport contract and its failure message
1 parent 4d7112b commit b51d3d3

1 file changed

Lines changed: 28 additions & 4 deletions

File tree

‎src/apify_client/http_clients/_base.py‎

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,9 +473,21 @@ def send_request(
473473
"""Send one request through the underlying HTTP library.
474474
475475
Required by the inherited `call`, so a transport adapter must implement it. Overriding `call` itself
476-
bypasses it entirely.
476+
bypasses it entirely. Let the HTTP library's exceptions propagate unwrapped: `call` classifies them
477+
through `is_retryable_transport_error` and `is_timeout_error`.
478+
479+
Args:
480+
method: HTTP method (GET, POST, PUT, DELETE, etc.).
481+
url: Full request URL, with the query parameters already encoded into it.
482+
headers: Final request headers, with the client's default headers already merged in.
483+
content: Request body, already serialized and compressed, or None for a request without a body.
484+
timeout: Timeout for this attempt in seconds, or None for no timeout at all.
485+
stream: Whether to return the response with the body unread, so the caller can stream it.
486+
487+
Returns:
488+
The HTTP response object.
477489
"""
478-
raise NotImplementedError
490+
raise NotImplementedError('Implement `send_request` to provide a transport, or override `call` entirely.')
479491

480492
@staticmethod
481493
def _retry_with_exp_backoff(
@@ -678,9 +690,21 @@ async def send_request(
678690
"""Send one request through the underlying HTTP library.
679691
680692
Required by the inherited `call`, so a transport adapter must implement it. Overriding `call` itself
681-
bypasses it entirely.
693+
bypasses it entirely. Let the HTTP library's exceptions propagate unwrapped: `call` classifies them
694+
through `is_retryable_transport_error` and `is_timeout_error`.
695+
696+
Args:
697+
method: HTTP method (GET, POST, PUT, DELETE, etc.).
698+
url: Full request URL, with the query parameters already encoded into it.
699+
headers: Final request headers, with the client's default headers already merged in.
700+
content: Request body, already serialized and compressed, or None for a request without a body.
701+
timeout: Timeout for this attempt in seconds, or None for no timeout at all.
702+
stream: Whether to return the response with the body unread, so the caller can stream it.
703+
704+
Returns:
705+
The HTTP response object.
682706
"""
683-
raise NotImplementedError
707+
raise NotImplementedError('Implement `send_request` to provide a transport, or override `call` entirely.')
684708

685709
@staticmethod
686710
async def _retry_with_exp_backoff(

0 commit comments

Comments
 (0)