Skip to content

Global timeout #3357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

andybbruno
Copy link

@andybbruno andybbruno commented Oct 22, 2024

Summary

This pull request introduces a new, more straightforward way to configure a global default timeout for all clients and requests in httpx without needing to access the internal _config object. The enhancement is achieved by exposing the DEFAULT_TIMEOUT_CONFIG in the main __init__.py file (see discussion here).

This change simplifies the process, allowing developers to set a global timeout directly and elegantly, like so:

import httpx
httpx.DEFAULT_TIMEOUT_CONFIG = httpx.Timeout(10.0)

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

@andybbruno andybbruno force-pushed the feature/global-timeout branch 2 times, most recently from 5eff359 to 554f03f Compare October 22, 2024 14:46
@andybbruno andybbruno force-pushed the feature/global-timeout branch from 554f03f to ef81b12 Compare October 22, 2024 14:48
@andybbruno andybbruno marked this pull request as ready for review October 22, 2024 14:52
@tomchristie
Copy link
Member

Thanks @andybbruno - do appreciate your time & interest on this.

The proposal (exposing a global constant as public API) doesn't really match the coding style in other parts of the project,
and I don't think we reached a resolution on #3356. We'd need a clearer consensus before accepting PRs in this direction.

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.

2 participants