Skip to content

Commit a2a69e4

Browse files
authored
Mention default timeout differences from Requests in compatibility docs (#2433)
I was recently migrating a project from Requests to HTTPX, and I stumbled a bit on the default socket timeouts being different between the two, which I haven't seen explicitly mentioned anywhere. This adds a mention of those differences to the compatibility section, feel free to edit it or move it around as you choose.
1 parent 8752e26 commit a2a69e4

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

docs/compatibility.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,16 @@ Within a `stream()` block request data is made available with:
145145
* `.iter_raw()` - Use this instead of `response.raw`
146146
* `.read()` - Read the entire response body, making `request.text` and `response.content` available.
147147

148+
## Timeouts
149+
150+
HTTPX defaults to including reasonable [timeouts](quickstart.md#timeouts) for all network operations, while Requests has no timeouts by default.
151+
152+
To get the same behavior as Requests, set the `timeout` parameter to `None`:
153+
154+
```python
155+
httpx.get('https://www.example.com', timeout=None)
156+
```
157+
148158
## Proxy keys
149159

150160
When using `httpx.Client(proxies={...})` to map to a selection of different proxies, we use full URL schemes, such as `proxies={"http://": ..., "https://": ...}`.

0 commit comments

Comments
 (0)