[BUG] AsyncTwilioHttpClient.request does not use self.timeout
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
Research direction
Start at the AsyncTwilioHttpClient.request entry point shown in the issue and compare its timeout handling with TwilioHttpClient.request. Check the existing tests for these clients before making the change. Done means a missing timeout uses self.timeout while nonpositive explicit values still raise ValueError, with coverage for both cases.
Written by the indexing model from the issue text.
Description
Describe the bug
AsyncTwilioHttpClient.request never falls back to self.timeout if timeout is None
Code snippet
if timeout is not None and timeout <= 0:
raise ValueError(timeout)
basic_auth = None
if auth is not None:
basic_auth = BasicAuth(login=auth[0], password=auth[1])
kwargs = {
"method": method.upper(),
"url": url,
"params": params,
"data": data,
"headers": headers,
"auth": basic_auth,
"timeout": timeout,
"allow_redirects": allow_redirects,
}
self.log_request(kwargs)
self._test_only_last_response = None
temp = False
session = None
if self.session:
session = self.session
else:
session = ClientSession()
temp = True
self._test_only_last_request = TwilioRequest(**kwargs)
response = await session.request(**kwargs)
Actual behavior
response is passed "timeout": None in kwargs instead of "timeout": self.timeout when no timeout argument is passed
Expected behavior
response is passed "timeout": self.timeout in kwargs when no timeout argument is passed, this is what (sync) TwilioHttpClient does:
if timeout is None:
timeout = self.timeout
elif timeout <= 0:
raise ValueError(timeout)
twilio-python version
9.10.9
Python version
3
Logs or error messages
No response
Additional context
No response
- Dominant language
- Python
- Stars
- 2.1k
- Forks
- 815
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from twilio/twilio-python
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
twilio/twilio-python#932 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
twilio/twilio-python#930 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
twilio/twilio-python#916 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
twilio/twilio-python#883 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
twilio/twilio-python#945 ·
All issues in twilio/twilio-python
Similar issues
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
simonw/sqlite-utils#872 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100