Skip to content
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

Global timeout #3357

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

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 marked this pull request as ready for review October 22, 2024 14:52
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.

1 participant