]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Add stream docstring (#1200)
authorJoe <nigelchiang@outlook.com>
Thu, 20 Aug 2020 09:28:28 +0000 (17:28 +0800)
committerGitHub <noreply@github.com>
Thu, 20 Aug 2020 09:28:28 +0000 (10:28 +0100)
* Add stream() docstring

* Update docs

docs/api.md
httpx/_api.py
httpx/_client.py

index db57f3e7ac10ecdc8bf2636b3284ff26b6b42bc7..710072c8ef7242a730f08ac0c6937690308dffa2 100644 (file)
 
 ::: httpx.delete
     :docstring:
+    
+::: httpx.stream
+    :docstring:
 
 ## `Client`
 
 ::: httpx.Client
     :docstring:
-    :members: headers cookies params auth request get head options post put patch delete build_request send close
+    :members: headers cookies params auth request get head options post put patch delete stream build_request send close
 
 ## `AsyncClient`
 
 ::: httpx.AsyncClient
     :docstring:
-    :members: headers cookies params auth request get head options post put patch delete build_request send aclose
+    :members: headers cookies params auth request get head options post put patch delete stream build_request send aclose
 
 
 ## `Response`
index 9b130ea4bed529088eacc8b68384ffded4753e08..ba7bed398ae1aa98c3e254f2271d63916a27996c 100644 (file)
@@ -118,6 +118,16 @@ def stream(
     cert: CertTypes = None,
     trust_env: bool = True,
 ) -> StreamContextManager:
+    """
+    Alternative to `httpx.request()` that streams the response body
+    instead of loading it into memory at once.
+
+    **Parameters**: See `httpx.request`.
+
+    See also: [Streaming Responses][0]
+
+    [0]: /quickstart#streaming-responses
+    """
     client = Client(proxies=proxies, cert=cert, verify=verify, trust_env=trust_env)
     request = Request(
         method=method,
index 07ef60c432341c344aa021971ca4c7f2123b27a1..2d2ca9ac1612d9dadc9a6943f7930527d345bb3d 100644 (file)
@@ -191,6 +191,16 @@ class BaseClient:
         allow_redirects: bool = True,
         timeout: typing.Union[TimeoutTypes, UnsetType] = UNSET,
     ) -> "StreamContextManager":
+        """
+        Alternative to `httpx.request()` that streams the response body
+        instead of loading it into memory at once.
+
+        **Parameters**: See `httpx.request`.
+
+        See also: [Streaming Responses][0]
+
+        [0]: /quickstart#streaming-responses
+        """
         request = self.build_request(
             method=method,
             url=url,