]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Rename 'close' to 'aclose' on Client (#675)
authorFlorimond Manca <florimond.manca@gmail.com>
Sun, 29 Dec 2019 15:15:09 +0000 (16:15 +0100)
committerTom Christie <tom@tomchristie.com>
Sun, 29 Dec 2019 15:15:09 +0000 (15:15 +0000)
* Switch to aclose on Client

* Fix reference to aclose in API docs

docs/advanced.md
docs/api.md
httpx/client.py

index 8845348d79ad6871476e4574191da8f0560bbc6a..46e16cce49cd9daf6daf0514939b23ed40cc98e3 100644 (file)
@@ -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]>
index 62380f9126d84a87e91ec90f34b783cde84967a4..06126b00d0aba7fee56e6d78d9404231da4fa6fe 100644 (file)
@@ -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`
 
index 2596cd531e55c796f0d4f6098287bcdda8b2ca05..d01707858bbf522cc7e5d9f1dd59454a46592159 100644 (file)
@@ -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()