Drop per-request 'cert'/'verify'/'trust_env', and 'stream=bool' arguments (#730)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Tom Christie · committed by GitHub · parent 2b92a78 · Browse files · 2 files·+1 added−109 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+1 added−109 removed
- other:+1 added−109 removed
Provenance
- Commit
c5037f0- Tree
c195363- Author
Tom Christie <tom@tomchristie.com>- Committer
GitHub <noreply@github.com>- Parent
2b92a78
2 files changed+1 added−109 removed
modified:httpx/api.py-16 removed
28 unmodified lines29 timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,30 allow_redirects: bool = True,31 verify: VerifyTypes = True,32 cert: CertTypes = None,33- stream: bool = False,33 trust_env: bool = True,34 ) -> Response:35 """36 Sends an HTTP request.54 unmodified lines91 json=json,92 params=params,93 headers=headers,94 cookies=cookies,96- stream=stream,95 auth=auth,96 allow_redirects=allow_redirects,97 )98 41 unmodified lines140 *,141 params: QueryParamTypes = None,142 headers: HeaderTypes = None,143 cookies: CookieTypes = None,146- stream: bool = False,144 auth: AuthTypes = None,145 allow_redirects: bool = True,146 cert: CertTypes = None,147 verify: VerifyTypes = True,13 unmodified lines161 url,162 params=params,163 headers=headers,164 cookies=cookies,168- stream=stream,165 auth=auth,166 allow_redirects=allow_redirects,167 cert=cert,168 verify=verify,7 unmodified lines176 *,177 params: QueryParamTypes = None,178 headers: HeaderTypes = None,179 cookies: CookieTypes = None,184- stream: bool = False,180 auth: AuthTypes = None,181 allow_redirects: bool = True,182 cert: CertTypes = None,183 verify: VerifyTypes = True,13 unmodified lines197 url,198 params=params,199 headers=headers,200 cookies=cookies,206- stream=stream,201 auth=auth,202 allow_redirects=allow_redirects,203 cert=cert,204 verify=verify,7 unmodified lines212 *,213 params: QueryParamTypes = None,214 headers: HeaderTypes = None,215 cookies: CookieTypes = None,222- stream: bool = False,216 auth: AuthTypes = None,217 allow_redirects: bool = False, # Note: Differs to usual default.218 cert: CertTypes = None,219 verify: VerifyTypes = True,15 unmodified lines235 url,236 params=params,237 headers=headers,238 cookies=cookies,246- stream=stream,239 auth=auth,240 allow_redirects=allow_redirects,241 cert=cert,242 verify=verify,10 unmodified lines253 json: typing.Any = None,254 params: QueryParamTypes = None,255 headers: HeaderTypes = None,256 cookies: CookieTypes = None,265- stream: bool = False,257 auth: AuthTypes = None,258 allow_redirects: bool = True,259 cert: CertTypes = None,260 verify: VerifyTypes = True,13 unmodified lines274 json=json,275 params=params,276 headers=headers,277 cookies=cookies,287- stream=stream,278 auth=auth,279 allow_redirects=allow_redirects,280 cert=cert,281 verify=verify,10 unmodified lines292 json: typing.Any = None,293 params: QueryParamTypes = None,294 headers: HeaderTypes = None,295 cookies: CookieTypes = None,306- stream: bool = False,296 auth: AuthTypes = None,297 allow_redirects: bool = True,298 cert: CertTypes = None,299 verify: VerifyTypes = True,13 unmodified lines313 json=json,314 params=params,315 headers=headers,316 cookies=cookies,328- stream=stream,317 auth=auth,318 allow_redirects=allow_redirects,319 cert=cert,320 verify=verify,10 unmodified lines331 json: typing.Any = None,332 params: QueryParamTypes = None,333 headers: HeaderTypes = None,334 cookies: CookieTypes = None,347- stream: bool = False,335 auth: AuthTypes = None,336 allow_redirects: bool = True,337 cert: CertTypes = None,338 verify: VerifyTypes = True,13 unmodified lines352 json=json,353 params=params,354 headers=headers,355 cookies=cookies,369- stream=stream,356 auth=auth,357 allow_redirects=allow_redirects,358 cert=cert,359 verify=verify,7 unmodified lines367 *,368 params: QueryParamTypes = None,369 headers: HeaderTypes = None,370 cookies: CookieTypes = None,385- stream: bool = False,371 auth: AuthTypes = None,372 allow_redirects: bool = True,373 cert: CertTypes = None,374 verify: VerifyTypes = True,13 unmodified lines388 url,389 params=params,390 headers=headers,391 cookies=cookies,407- stream=stream,392 auth=auth,393 allow_redirects=allow_redirects,394 cert=cert,395 verify=verify,3 unmodified linesmodified:httpx/client.py+1 added-93 removed
1 import functools2 import typing3-import warnings3 from types import TracebackType4 5 import hstspreload6 574 unmodified lines581 json: typing.Any = None,582 params: QueryParamTypes = None,583 headers: HeaderTypes = None,584 cookies: CookieTypes = None,586- stream: bool = False,585 auth: AuthTypes = None,586 allow_redirects: bool = True,589- cert: CertTypes = None,590- verify: VerifyTypes = None,587 timeout: typing.Union[TimeoutTypes, UnsetType] = UNSET,592- trust_env: bool = None,588 ) -> Response:594- if cert is not None: # pragma: nocover595- raise RuntimeError(596- "Passing a 'cert' argument when making a request on a client "597- "is not supported anymore. Instantiate a new client instead, "598- "passing any 'cert' arguments to the client itself."599- )600-601- if verify is not None: # pragma: nocover602- raise RuntimeError(603- "Passing a 'verify' argument when making a request on a client "604- "is not supported anymore. Instantiate a new client instead, "605- "passing any 'verify' arguments to the client itself."606- )607-608- if trust_env is not None: # pragma: nocover609- raise RuntimeError(610- "Passing a 'trust_env' argument when making a request on a client "611- "is not supported anymore. Instantiate a new client instead, "612- "passing any 'trust_env' argument to the client itself."613- )614-615- if stream: # pragma: nocover616- warnings.warn(617- "The 'stream=True' argument is due to be deprecated. "618- "Use 'async with client.stream(method, url, ...) as response' instead."619- )620-589 request = self.build_request(590 method=method,591 url=url,592 data=data,3 unmodified lines596 headers=headers,597 cookies=cookies,598 )599 response = await self.send(632- request,633- stream=stream,634- auth=auth,635- allow_redirects=allow_redirects,636- timeout=timeout,600+ request, auth=auth, allow_redirects=allow_redirects, timeout=timeout,601 )602 return response603 604 async def send(121 unmodified lines726 *,727 params: QueryParamTypes = None,728 headers: HeaderTypes = None,729 cookies: CookieTypes = None,766- stream: bool = False,730 auth: AuthTypes = None,731 allow_redirects: bool = True,769- cert: CertTypes = None,770- verify: VerifyTypes = None,732 timeout: typing.Union[TimeoutTypes, UnsetType] = UNSET,772- trust_env: bool = None,733 ) -> Response:734 return await self.request(735 "GET",736 url,737 params=params,738 headers=headers,739 cookies=cookies,780- stream=stream,740 auth=auth,741 allow_redirects=allow_redirects,783- verify=verify,784- cert=cert,742 timeout=timeout,786- trust_env=trust_env,743 )744 745 async def options(746 self,1 unmodified line748 *,749 params: QueryParamTypes = None,750 headers: HeaderTypes = None,751 cookies: CookieTypes = None,796- stream: bool = False,752 auth: AuthTypes = None,753 allow_redirects: bool = True,799- cert: CertTypes = None,800- verify: VerifyTypes = None,754 timeout: typing.Union[TimeoutTypes, UnsetType] = UNSET,802- trust_env: bool = None,755 ) -> Response:756 return await self.request(757 "OPTIONS",758 url,759 params=params,760 headers=headers,761 cookies=cookies,810- stream=stream,762 auth=auth,763 allow_redirects=allow_redirects,813- verify=verify,814- cert=cert,764 timeout=timeout,816- trust_env=trust_env,765 )766 767 async def head(768 self,1 unmodified line770 *,771 params: QueryParamTypes = None,772 headers: HeaderTypes = None,773 cookies: CookieTypes = None,826- stream: bool = False,774 auth: AuthTypes = None,775 allow_redirects: bool = False, # NOTE: Differs to usual default.829- cert: CertTypes = None,830- verify: VerifyTypes = None,776 timeout: typing.Union[TimeoutTypes, UnsetType] = UNSET,832- trust_env: bool = None,777 ) -> Response:778 return await self.request(779 "HEAD",780 url,781 params=params,782 headers=headers,783 cookies=cookies,840- stream=stream,784 auth=auth,785 allow_redirects=allow_redirects,843- verify=verify,844- cert=cert,786 timeout=timeout,846- trust_env=trust_env,787 )788 789 async def post(790 self,4 unmodified lines795 json: typing.Any = None,796 params: QueryParamTypes = None,797 headers: HeaderTypes = None,798 cookies: CookieTypes = None,859- stream: bool = False,799 auth: AuthTypes = None,800 allow_redirects: bool = True,862- cert: CertTypes = None,863- verify: VerifyTypes = None,801 timeout: typing.Union[TimeoutTypes, UnsetType] = UNSET,865- trust_env: bool = None,802 ) -> Response:803 return await self.request(804 "POST",805 url,2 unmodified lines808 json=json,809 params=params,810 headers=headers,811 cookies=cookies,876- stream=stream,812 auth=auth,813 allow_redirects=allow_redirects,879- verify=verify,880- cert=cert,814 timeout=timeout,882- trust_env=trust_env,815 )816 817 async def put(818 self,4 unmodified lines823 json: typing.Any = None,824 params: QueryParamTypes = None,825 headers: HeaderTypes = None,826 cookies: CookieTypes = None,895- stream: bool = False,827 auth: AuthTypes = None,828 allow_redirects: bool = True,898- cert: CertTypes = None,899- verify: VerifyTypes = None,829 timeout: typing.Union[TimeoutTypes, UnsetType] = UNSET,901- trust_env: bool = None,830 ) -> Response:831 return await self.request(832 "PUT",833 url,2 unmodified lines836 json=json,837 params=params,838 headers=headers,839 cookies=cookies,912- stream=stream,840 auth=auth,841 allow_redirects=allow_redirects,915- verify=verify,916- cert=cert,842 timeout=timeout,918- trust_env=trust_env,843 )844 845 async def patch(846 self,4 unmodified lines851 json: typing.Any = None,852 params: QueryParamTypes = None,853 headers: HeaderTypes = None,854 cookies: CookieTypes = None,931- stream: bool = False,855 auth: AuthTypes = None,856 allow_redirects: bool = True,934- cert: CertTypes = None,935- verify: VerifyTypes = None,857 timeout: typing.Union[TimeoutTypes, UnsetType] = UNSET,937- trust_env: bool = None,858 ) -> Response:859 return await self.request(860 "PATCH",861 url,2 unmodified lines864 json=json,865 params=params,866 headers=headers,867 cookies=cookies,948- stream=stream,868 auth=auth,869 allow_redirects=allow_redirects,951- verify=verify,952- cert=cert,870 timeout=timeout,954- trust_env=trust_env,871 )872 873 async def delete(874 self,1 unmodified line876 *,877 params: QueryParamTypes = None,878 headers: HeaderTypes = None,879 cookies: CookieTypes = None,964- stream: bool = False,880 auth: AuthTypes = None,881 allow_redirects: bool = True,967- cert: CertTypes = None,968- verify: VerifyTypes = None,882 timeout: typing.Union[TimeoutTypes, UnsetType] = UNSET,970- trust_env: bool = None,883 ) -> Response:884 return await self.request(885 "DELETE",886 url,887 params=params,888 headers=headers,889 cookies=cookies,978- stream=stream,890 auth=auth,891 allow_redirects=allow_redirects,981- verify=verify,982- cert=cert,892 timeout=timeout,984- trust_env=trust_env,893 )894 895 async def aclose(self) -> None:896 await self.dispatch.close()54 unmodified lines