Rename 'close' to 'aclose' on Client (#675)
* Switch to aclose on Client * Fix reference to aclose in API docs
This commit is contained in:
parent
f9d18a8758
commit
d5da7430a2
@ -21,14 +21,14 @@ The recommended way to use a `Client` is as a context manager. This will ensure
|
||||
<Response [200 OK]>
|
||||
```
|
||||
|
||||
Alternatively, you can explicitly close the connection pool without block-usage using `.close()`:
|
||||
Alternatively, you can explicitly close the connection pool without block-usage using `.aclose()`:
|
||||
|
||||
```python
|
||||
>>> client = httpx.Client()
|
||||
>>> try:
|
||||
... r = await client.get('https://example.com')
|
||||
... finally:
|
||||
... await client.close()
|
||||
... await client.aclose()
|
||||
...
|
||||
>>> r
|
||||
<Response [200 OK]>
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
::: httpx.Client
|
||||
:docstring:
|
||||
:members: headers cookies params request get head options post put patch delete build_request send close
|
||||
:members: headers cookies params request get head options post put patch delete build_request send aclose
|
||||
|
||||
## `Response`
|
||||
|
||||
|
||||
@ -865,7 +865,7 @@ class Client:
|
||||
trust_env=trust_env,
|
||||
)
|
||||
|
||||
async def close(self) -> None:
|
||||
async def aclose(self) -> None:
|
||||
await self.dispatch.close()
|
||||
|
||||
async def __aenter__(self) -> "Client":
|
||||
@ -877,7 +877,7 @@ class Client:
|
||||
exc_value: BaseException = None,
|
||||
traceback: TracebackType = None,
|
||||
) -> None:
|
||||
await self.close()
|
||||
await self.aclose()
|
||||
|
||||
|
||||
def _proxies_to_dispatchers(
|
||||
@ -956,4 +956,4 @@ class StreamContextManager:
|
||||
) -> None:
|
||||
await self.response.aclose()
|
||||
if self.close_client:
|
||||
await self.client.close()
|
||||
await self.client.aclose()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user