]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Drop per-request 'cert'/'verify'/'trust_env', and 'stream=bool' arguments (#730)
authorTom Christie <tom@tomchristie.com>
Tue, 7 Jan 2020 12:24:26 +0000 (12:24 +0000)
committerGitHub <noreply@github.com>
Tue, 7 Jan 2020 12:24:26 +0000 (12:24 +0000)
httpx/api.py
httpx/client.py

index c8b9f65f883b814fc06d02f616473a434e24d0e2..bf9d60320fe33904443fdb8213cbddfaabc20a9e 100644 (file)
@@ -30,7 +30,6 @@ async def request(
     allow_redirects: bool = True,
     verify: VerifyTypes = True,
     cert: CertTypes = None,
-    stream: bool = False,
     trust_env: bool = True,
 ) -> Response:
     """
@@ -93,7 +92,6 @@ async def request(
             params=params,
             headers=headers,
             cookies=cookies,
-            stream=stream,
             auth=auth,
             allow_redirects=allow_redirects,
         )
@@ -143,7 +141,6 @@ async def get(
     params: QueryParamTypes = None,
     headers: HeaderTypes = None,
     cookies: CookieTypes = None,
-    stream: bool = False,
     auth: AuthTypes = None,
     allow_redirects: bool = True,
     cert: CertTypes = None,
@@ -165,7 +162,6 @@ async def get(
         params=params,
         headers=headers,
         cookies=cookies,
-        stream=stream,
         auth=auth,
         allow_redirects=allow_redirects,
         cert=cert,
@@ -181,7 +177,6 @@ async def options(
     params: QueryParamTypes = None,
     headers: HeaderTypes = None,
     cookies: CookieTypes = None,
-    stream: bool = False,
     auth: AuthTypes = None,
     allow_redirects: bool = True,
     cert: CertTypes = None,
@@ -203,7 +198,6 @@ async def options(
         params=params,
         headers=headers,
         cookies=cookies,
-        stream=stream,
         auth=auth,
         allow_redirects=allow_redirects,
         cert=cert,
@@ -219,7 +213,6 @@ async def head(
     params: QueryParamTypes = None,
     headers: HeaderTypes = None,
     cookies: CookieTypes = None,
-    stream: bool = False,
     auth: AuthTypes = None,
     allow_redirects: bool = False,  # Note: Differs to usual default.
     cert: CertTypes = None,
@@ -243,7 +236,6 @@ async def head(
         params=params,
         headers=headers,
         cookies=cookies,
-        stream=stream,
         auth=auth,
         allow_redirects=allow_redirects,
         cert=cert,
@@ -262,7 +254,6 @@ async def post(
     params: QueryParamTypes = None,
     headers: HeaderTypes = None,
     cookies: CookieTypes = None,
-    stream: bool = False,
     auth: AuthTypes = None,
     allow_redirects: bool = True,
     cert: CertTypes = None,
@@ -284,7 +275,6 @@ async def post(
         params=params,
         headers=headers,
         cookies=cookies,
-        stream=stream,
         auth=auth,
         allow_redirects=allow_redirects,
         cert=cert,
@@ -303,7 +293,6 @@ async def put(
     params: QueryParamTypes = None,
     headers: HeaderTypes = None,
     cookies: CookieTypes = None,
-    stream: bool = False,
     auth: AuthTypes = None,
     allow_redirects: bool = True,
     cert: CertTypes = None,
@@ -325,7 +314,6 @@ async def put(
         params=params,
         headers=headers,
         cookies=cookies,
-        stream=stream,
         auth=auth,
         allow_redirects=allow_redirects,
         cert=cert,
@@ -344,7 +332,6 @@ async def patch(
     params: QueryParamTypes = None,
     headers: HeaderTypes = None,
     cookies: CookieTypes = None,
-    stream: bool = False,
     auth: AuthTypes = None,
     allow_redirects: bool = True,
     cert: CertTypes = None,
@@ -366,7 +353,6 @@ async def patch(
         params=params,
         headers=headers,
         cookies=cookies,
-        stream=stream,
         auth=auth,
         allow_redirects=allow_redirects,
         cert=cert,
@@ -382,7 +368,6 @@ async def delete(
     params: QueryParamTypes = None,
     headers: HeaderTypes = None,
     cookies: CookieTypes = None,
-    stream: bool = False,
     auth: AuthTypes = None,
     allow_redirects: bool = True,
     cert: CertTypes = None,
@@ -404,7 +389,6 @@ async def delete(
         params=params,
         headers=headers,
         cookies=cookies,
-        stream=stream,
         auth=auth,
         allow_redirects=allow_redirects,
         cert=cert,
index 224baad776aff7b5cf578a9e6f73437fa5751e65..45b6ec70411b625869d062ff343398a79c74aedf 100644 (file)
@@ -1,6 +1,5 @@
 import functools
 import typing
-import warnings
 from types import TracebackType
 
 import hstspreload
@@ -583,41 +582,10 @@ class AsyncClient:
         params: QueryParamTypes = None,
         headers: HeaderTypes = None,
         cookies: CookieTypes = None,
-        stream: bool = False,
         auth: AuthTypes = None,
         allow_redirects: bool = True,
-        cert: CertTypes = None,
-        verify: VerifyTypes = None,
         timeout: typing.Union[TimeoutTypes, UnsetType] = UNSET,
-        trust_env: bool = None,
     ) -> Response:
-        if cert is not None:  # pragma: nocover
-            raise RuntimeError(
-                "Passing a 'cert' argument when making a request on a client "
-                "is not supported anymore. Instantiate a new client instead, "
-                "passing any 'cert' arguments to the client itself."
-            )
-
-        if verify is not None:  # pragma: nocover
-            raise RuntimeError(
-                "Passing a 'verify' argument when making a request on a client "
-                "is not supported anymore. Instantiate a new client instead, "
-                "passing any 'verify' arguments to the client itself."
-            )
-
-        if trust_env is not None:  # pragma: nocover
-            raise RuntimeError(
-                "Passing a 'trust_env' argument when making a request on a client "
-                "is not supported anymore. Instantiate a new client instead, "
-                "passing any 'trust_env' argument to the client itself."
-            )
-
-        if stream:  # pragma: nocover
-            warnings.warn(
-                "The 'stream=True' argument is due to be deprecated. "
-                "Use 'async with client.stream(method, url, ...) as response' instead."
-            )
-
         request = self.build_request(
             method=method,
             url=url,
@@ -629,11 +597,7 @@ class AsyncClient:
             cookies=cookies,
         )
         response = await self.send(
-            request,
-            stream=stream,
-            auth=auth,
-            allow_redirects=allow_redirects,
-            timeout=timeout,
+            request, auth=auth, allow_redirects=allow_redirects, timeout=timeout,
         )
         return response
 
@@ -763,13 +727,9 @@ class AsyncClient:
         params: QueryParamTypes = None,
         headers: HeaderTypes = None,
         cookies: CookieTypes = None,
-        stream: bool = False,
         auth: AuthTypes = None,
         allow_redirects: bool = True,
-        cert: CertTypes = None,
-        verify: VerifyTypes = None,
         timeout: typing.Union[TimeoutTypes, UnsetType] = UNSET,
-        trust_env: bool = None,
     ) -> Response:
         return await self.request(
             "GET",
@@ -777,13 +737,9 @@ class AsyncClient:
             params=params,
             headers=headers,
             cookies=cookies,
-            stream=stream,
             auth=auth,
             allow_redirects=allow_redirects,
-            verify=verify,
-            cert=cert,
             timeout=timeout,
-            trust_env=trust_env,
         )
 
     async def options(
@@ -793,13 +749,9 @@ class AsyncClient:
         params: QueryParamTypes = None,
         headers: HeaderTypes = None,
         cookies: CookieTypes = None,
-        stream: bool = False,
         auth: AuthTypes = None,
         allow_redirects: bool = True,
-        cert: CertTypes = None,
-        verify: VerifyTypes = None,
         timeout: typing.Union[TimeoutTypes, UnsetType] = UNSET,
-        trust_env: bool = None,
     ) -> Response:
         return await self.request(
             "OPTIONS",
@@ -807,13 +759,9 @@ class AsyncClient:
             params=params,
             headers=headers,
             cookies=cookies,
-            stream=stream,
             auth=auth,
             allow_redirects=allow_redirects,
-            verify=verify,
-            cert=cert,
             timeout=timeout,
-            trust_env=trust_env,
         )
 
     async def head(
@@ -823,13 +771,9 @@ class AsyncClient:
         params: QueryParamTypes = None,
         headers: HeaderTypes = None,
         cookies: CookieTypes = None,
-        stream: bool = False,
         auth: AuthTypes = None,
         allow_redirects: bool = False,  # NOTE: Differs to usual default.
-        cert: CertTypes = None,
-        verify: VerifyTypes = None,
         timeout: typing.Union[TimeoutTypes, UnsetType] = UNSET,
-        trust_env: bool = None,
     ) -> Response:
         return await self.request(
             "HEAD",
@@ -837,13 +781,9 @@ class AsyncClient:
             params=params,
             headers=headers,
             cookies=cookies,
-            stream=stream,
             auth=auth,
             allow_redirects=allow_redirects,
-            verify=verify,
-            cert=cert,
             timeout=timeout,
-            trust_env=trust_env,
         )
 
     async def post(
@@ -856,13 +796,9 @@ class AsyncClient:
         params: QueryParamTypes = None,
         headers: HeaderTypes = None,
         cookies: CookieTypes = None,
-        stream: bool = False,
         auth: AuthTypes = None,
         allow_redirects: bool = True,
-        cert: CertTypes = None,
-        verify: VerifyTypes = None,
         timeout: typing.Union[TimeoutTypes, UnsetType] = UNSET,
-        trust_env: bool = None,
     ) -> Response:
         return await self.request(
             "POST",
@@ -873,13 +809,9 @@ class AsyncClient:
             params=params,
             headers=headers,
             cookies=cookies,
-            stream=stream,
             auth=auth,
             allow_redirects=allow_redirects,
-            verify=verify,
-            cert=cert,
             timeout=timeout,
-            trust_env=trust_env,
         )
 
     async def put(
@@ -892,13 +824,9 @@ class AsyncClient:
         params: QueryParamTypes = None,
         headers: HeaderTypes = None,
         cookies: CookieTypes = None,
-        stream: bool = False,
         auth: AuthTypes = None,
         allow_redirects: bool = True,
-        cert: CertTypes = None,
-        verify: VerifyTypes = None,
         timeout: typing.Union[TimeoutTypes, UnsetType] = UNSET,
-        trust_env: bool = None,
     ) -> Response:
         return await self.request(
             "PUT",
@@ -909,13 +837,9 @@ class AsyncClient:
             params=params,
             headers=headers,
             cookies=cookies,
-            stream=stream,
             auth=auth,
             allow_redirects=allow_redirects,
-            verify=verify,
-            cert=cert,
             timeout=timeout,
-            trust_env=trust_env,
         )
 
     async def patch(
@@ -928,13 +852,9 @@ class AsyncClient:
         params: QueryParamTypes = None,
         headers: HeaderTypes = None,
         cookies: CookieTypes = None,
-        stream: bool = False,
         auth: AuthTypes = None,
         allow_redirects: bool = True,
-        cert: CertTypes = None,
-        verify: VerifyTypes = None,
         timeout: typing.Union[TimeoutTypes, UnsetType] = UNSET,
-        trust_env: bool = None,
     ) -> Response:
         return await self.request(
             "PATCH",
@@ -945,13 +865,9 @@ class AsyncClient:
             params=params,
             headers=headers,
             cookies=cookies,
-            stream=stream,
             auth=auth,
             allow_redirects=allow_redirects,
-            verify=verify,
-            cert=cert,
             timeout=timeout,
-            trust_env=trust_env,
         )
 
     async def delete(
@@ -961,13 +877,9 @@ class AsyncClient:
         params: QueryParamTypes = None,
         headers: HeaderTypes = None,
         cookies: CookieTypes = None,
-        stream: bool = False,
         auth: AuthTypes = None,
         allow_redirects: bool = True,
-        cert: CertTypes = None,
-        verify: VerifyTypes = None,
         timeout: typing.Union[TimeoutTypes, UnsetType] = UNSET,
-        trust_env: bool = None,
     ) -> Response:
         return await self.request(
             "DELETE",
@@ -975,13 +887,9 @@ class AsyncClient:
             params=params,
             headers=headers,
             cookies=cookies,
-            stream=stream,
             auth=auth,
             allow_redirects=allow_redirects,
-            verify=verify,
-            cert=cert,
             timeout=timeout,
-            trust_env=trust_env,
         )
 
     async def aclose(self) -> None: