Skip to content

[REQ][python] httpx in sync mode #23032

@AntoineDuComptoirDesPharmacies

Description

Is your feature request related to a problem? Please describe.

Currently, we are using the python client with urllib3 PoolManager.
However we have some servers that have timeout configured for connection idle since X seconds.
In some race conditions where request is sent at the exact same moment of server close the connection, our client is encountering the following error :
ConnectionResetError: [Errno 104] Connection reset by peer

As of today, the urllib3 library do not propose a keepalive_expiry property to force re-creation of HTTP connection when idle.

However the httpx library provide this natively.

Describe the solution you'd like

I saw that the httpx library have been added in v7.16.0 thanks to the work of @soapun ❤️ here :
#22021

It is really nice but it is implemented as a async only library.
We would like to be able to use this library through its sync client.
=> See difference between httpx.AsyncClient() and httpx.Client()

Describe alternatives you've considered

Currently we do not found any "clean" workaround.
The only way would be to trigger applicative retry on Errno 104 but it is a bit of useless overhead in our application.

Additional context

Our python client is targeting a local envoy proxy (sidecar) that have a idle client timeout of 1 hour to clean potential orphan HTTP connections.

Yours faithfully,
LCDP

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions