We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Environment:
Listing:
import asyncio import httpx async def request(url): async with httpx.AsyncClient() as client: try: await client.get(url) except BaseException as exc: print('Request exception', type(exc), exc) raise async def main(): url = 'http://1.2.3.4:1234/' # Some unreachable resource with delay task = asyncio.create_task(request(url)) await asyncio.sleep(1) task.cancel() try: await task except BaseException as exc: print('Task exception', type(exc), exc) asyncio.run(main())
Expected behavior:
Request exception <class 'asyncio.exceptions.CancelledError'> Task exception <class 'asyncio.exceptions.CancelledError'>
Actual behavior:
Request exception <class 'httpx.ConnectError'> All connection attempts failed Task exception <class 'httpx.ConnectError'> All connection attempts failed
The text was updated successfully, but these errors were encountered:
Answered on the discussion. Thanks for the prompt.
Sorry, something went wrong.
@tomchristie I guess the issue should be reopened due to the discussion evolve:
So the problem is there is no certainty which exception will be raised by httpx on cancellation of ongoing request.
Originally posted by @decaz in #2370 (reply in thread)
Let's continue this on #2370
No branches or pull requests
Environment:
Listing:
Expected behavior:
Actual behavior:
The text was updated successfully, but these errors were encountered: