Sync client ignores timeout for unreachable site (but async client works as expected) #3583
Unanswered
yazmolod
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I'm encountering an issue where the
timeout
argument seems to behave inconsistently between the synchronous and asynchronous clients.I'm trying to query a site that delays responses based on geolocation or VPN - if you're from the "wrong" country, it just hangs (likely silently blocks the connection). I'm setting a timeout of 3 seconds to avoid this, but only the async client behaves as expected.
Code to reproduce
Output:
Expected:
All three should timeout after ~3 seconds.
Actual:
Only the async client respects the timeout. Both sync and top-level httpx.get(...) calls hang for ~18 seconds.
Environment
httpx 0.28.1
python 3.13.0
Is this a bug or am I misunderstanding how
timeout
should work for sync requests? Would appreciate any insight - thanks in advance!Beta Was this translation helpful? Give feedback.
All reactions