You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the 0.18.1 version for python3, and I've identified a behavior that doesn't seem right (forgive me in case i'm mistaken). The _conn_request method from Http class inside __init__.py has the following lines right at the beginning of the method that includes a while condition to handle the maximum attempts of connection:
i = 0
seen_bad_status_line = False
while i < RETRIES:
<starts connection attempt>
Shouldn't it be an less or equal condition? There's a semantic issue with this approach since the first connection isn't actually a retry attempt, but it would do the trick. I have an use case in which I can't let more than one connection attempt, and I expected it would work when I set RETRIES = 0, since the expected would be to consider this amount after the first attempt. However I ended up having the RETRIES amount considered even at the initial attempt, which made the while condition fail and an
"local variable 'response' referenced before assignment" occurred afterwards, since in case of fail it ends up going straight to a return (response, content) line, but the response doesn't exist since it is declared inside the while loop.
The text was updated successfully, but these errors were encountered:
I'm using the 0.18.1 version for python3, and I've identified a behavior that doesn't seem right (forgive me in case i'm mistaken). The _conn_request method from Http class inside
__init__.py
has the following lines right at the beginning of the method that includes a while condition to handle the maximum attempts of connection:Shouldn't it be an less or equal condition? There's a semantic issue with this approach since the first connection isn't actually a retry attempt, but it would do the trick. I have an use case in which I can't let more than one connection attempt, and I expected it would work when I set RETRIES = 0, since the expected would be to consider this amount after the first attempt. However I ended up having the RETRIES amount considered even at the initial attempt, which made the while condition fail and an
"local variable 'response' referenced before assignment" occurred afterwards, since in case of fail it ends up going straight to a
return (response, content)
line, but the response doesn't exist since it is declared inside the while loop.The text was updated successfully, but these errors were encountered: