Skip to content

Commit 5ec91d4

Browse files
authored
Close transports (#38)
1 parent 091c87a commit 5ec91d4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

httpx_retries/transport.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,20 @@ def __init__(
5858
self._sync_transport = httpx.HTTPTransport()
5959
self._async_transport = httpx.AsyncHTTPTransport()
6060

61+
def close(self) -> None:
62+
"""
63+
Closes this transport.
64+
"""
65+
if self._sync_transport is not None:
66+
self._sync_transport.close()
67+
68+
async def aclose(self) -> None:
69+
"""
70+
Closes this transport.
71+
"""
72+
if self._async_transport is not None:
73+
await self._async_transport.aclose()
74+
6175
def handle_request(self, request: httpx.Request) -> httpx.Response:
6276
"""
6377
Sends an HTTP request, possibly with retries.

0 commit comments

Comments
 (0)