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

fix: add timeout for auth requests #1616

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

harkamaljot
Copy link

expose a parameter in the request constructor to allow the end user to pass in the custom timeout value. Currently _DEFAULT_TIMEOUT is being used, which may not be suitable for all the users

@harkamaljot harkamaljot requested review from a team as code owners October 24, 2024 16:40
@@ -184,6 +185,7 @@ def __call__(
"""
try:
_LOGGER.debug("Making request: %s %s", method, url)
timeout = timeout if timeout != _DEFAULT_TIMEOUT else self.timeout
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an edge case where someone sets t1 at the object level but they want default timeout for a specific request. They have no way of doing that now. Even if default timeout is passed to call explicitly, it is going to use the object level one.

@@ -137,9 +137,10 @@ class Request(transport.Request):
.. automethod:: __call__
"""

def __init__(self, session=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -137,9 +137,10 @@ class Request(transport.Request):
.. automethod:: __call__
"""

def __init__(self, session=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checkout how AuthorizedSession is handling the timeouts and see if we can adapt same. I see something about TimeGuards there as well.

@harkamaljot harkamaljot marked this pull request as draft October 24, 2024 21:26
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