Skip to content

docs: clarify timeout parameter behavior#7351

Open
Yanhu007 wants to merge 1 commit intopsf:mainfrom
Yanhu007:docs/clarify-timeout-parameter
Open

docs: clarify timeout parameter behavior#7351
Yanhu007 wants to merge 1 commit intopsf:mainfrom
Yanhu007:docs/clarify-timeout-parameter

Conversation

@Yanhu007
Copy link
Copy Markdown

Summary

Fixes #7350 — Clarify the timeout parameter docstring in requests.get() and related functions.

Changes

Expanded the :param timeout: docstring to explain:

  1. Single float = both timeouts: When a single float is provided, it applies as both the connect timeout and the read timeout
  2. Not a total limit: This is not a total time limit on the entire response — it applies per-recv() call
  3. Tuple for fine control: A (connect, read) tuple can be used to set them independently

Before

How many seconds to wait for the server to send data before giving up, as a float, or a (connect timeout, read timeout) tuple.

After

How many seconds to wait for the server to send data before giving up, as a float, or a (connect timeout, read timeout) tuple. When a single float is provided, it is used as both the connect and the read timeout. This is not a total time limit on the entire response download; it applies separately to the connection phase and to each recv() call while waiting for data from the server.

Expand the timeout docstring to explain that:
- A single float is used as both connect and read timeout
- It is not a total response time limit
- It applies per socket operation, not to the whole download

Fixes psf#7350
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Docs] Clarify behavior of timeout parameter in requests.get

1 participant