Skip to content

Incorrect exception caught on timeout #39

@denravonska

Description

@denravonska

I am using httpx 0.13.1 and 0.13.2, and simple-rest seems to have trouble translating their TimeoutException:

  File "env/lib/python3.8/site-packages/simple_rest_client/resource.py", line 131, in action_method
    return await make_async_request(client, request)
  File "env/lib/python3.8/site-packages/simple_rest_client/decorators.py", line 44, in wrapper
    except (httpx.TimeoutException,) as exc:
AttributeError: module 'httpx' has no attribute 'TimeoutException'

The original exception thrown is:

  File "env/lib/python3.8/site-packages/httpx/_client.py", line 1222, in send_handling_auth
    response = await self.send_single_request(request, timeout)
  File "env/lib/python3.8/site-packages/httpx/_client.py", line 1254, in send_single_request
    ) = await transport.request(
  File "env/lib/python3.8/site-packages/httpcore/_async/connection_pool.py", line 152, in request
    response = await connection.request(
  File "env/lib/python3.8/site-packages/httpcore/_async/connection.py", line 65, in request
    self.socket = await self._open_socket(timeout)
  File "env/lib/python3.8/site-packages/httpcore/_async/connection.py", line 85, in _open_socket
    return await self.backend.open_tcp_stream(
  File "env/lib/python3.8/site-packages/httpcore/_backends/auto.py", line 38, in open_tcp_stream
    return await self.backend.open_tcp_stream(hostname, port, ssl_context, timeout)
  File "env/lib/python3.8/site-packages/httpcore/_backends/asyncio.py", line 233, in open_tcp_stream
    return SocketStream(
  File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "env/lib/python3.8/site-packages/httpcore/_exceptions.py", line 12, in map_exceptions
    raise to_exc(exc) from None
httpcore._exceptions.ConnectTimeout

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions