client.py
This file
Path
httpcore/client.py
800 lines · 22.3 KiB · Python
Last changed by
Drop prepare_requestTom Christiebefore adoption37da9ed
History of this fileTake it
Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 1why, one step back1import asyncioMerge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
lines 2–4why, one step back2import typing3from types import TracebackType4Auth (#65)Tom Christiebefore adoption5afa7dd
line 5why, one step back5from .auth import HTTPBasicAuthMerge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
lines 6–9why, one step back6from .config import (7 DEFAULT_MAX_REDIRECTS,8 DEFAULT_POOL_LIMITS,9 DEFAULT_TIMEOUT_CONFIG,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
line 10why, one step back10 CertTypes,Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
line 11why, one step back11 PoolLimits,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 12–13why, one step back12 TimeoutTypes,13 VerifyTypes,Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
lines 14–15why, one step back14)15from .dispatch.connection_pool import ConnectionPoolMerge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 16why, one step back16from .exceptions import RedirectBodyUnavailable, RedirectLoop, TooManyRedirectsMerge pull request #60 from encode/concurrency-backend-classTom Christiebefore adoption3d997af
line 17why, one step back17from .interfaces import ConcurrencyBackend, DispatcherMerge pull request #42 from encode/query-paramsTom Christiebefore adoption3de0425
lines 18–19why, one step back18from .models import (19 URL,Auth (#65)Tom Christiebefore adoption5afa7dd
line 20why, one step back20 AuthTypes,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
lines 21–22why, one step back21 Cookies,22 CookieTypes,Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 23why, one step back23 Headers,Merge pull request #42 from encode/query-paramsTom Christiebefore adoption3de0425
lines 24–26why, one step back24 HeaderTypes,25 QueryParamTypes,26 Request,Merge pull request #44 from encode/request-dataTom Christiebefore adoption39a5c53
line 27why, one step back27 RequestData,Merge pull request #42 from encode/query-paramsTom Christiebefore adoption3de0425
line 28why, one step back28 Response,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 29why, one step back29 SyncResponse,Merge pull request #42 from encode/query-paramsTom Christiebefore adoption3de0425
lines 30–31why, one step back30 URLTypes,31)Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369
line 32why, one step back32from .status_codes import codesMerge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
lines 33–34why, one step back3334Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 35why, one step back35class AsyncClient:Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
lines 36–37why, one step back36 def __init__(37 self,Auth (#65)Tom Christiebefore adoption5afa7dd
line 38why, one step back38 auth: AuthTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 39why, one step back39 cookies: CookieTypes = None,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 40–42why, one step back40 verify: VerifyTypes = True,41 cert: CertTypes = None,42 timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,Truckin' onTom Christiebefore adoption6b60d95
line 43why, one step back43 pool_limits: PoolLimits = DEFAULT_POOL_LIMITS,Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
line 44why, one step back44 max_redirects: int = DEFAULT_MAX_REDIRECTS,Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 45why, one step back45 dispatch: Dispatcher = None,Merge pull request #60 from encode/concurrency-backend-classTom Christiebefore adoption3d997af
line 46why, one step back46 backend: ConcurrencyBackend = None,Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
line 47why, one step back47 ):Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 48why, one step back48 if dispatch is None:Merge pull request #60 from encode/concurrency-backend-classTom Christiebefore adoption3d997af
line 49why, one step back49 dispatch = ConnectionPool(Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 50–54why, one step back50 verify=verify,51 cert=cert,52 timeout=timeout,53 pool_limits=pool_limits,54 backend=backend,Merge pull request #60 from encode/concurrency-backend-classTom Christiebefore adoption3d997af
line 55why, one step back55 )Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
line 56why, one step back56Auth (#65)Tom Christiebefore adoption5afa7dd
line 57why, one step back57 self.auth = authCookie support (#73)Tom Christiebefore adoptionfeae0a8
line 58why, one step back58 self.cookies = Cookies(cookies)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 59–60why, one step back59 self.max_redirects = max_redirects60 self.dispatch = dispatchMerge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
lines 61–63why, one step back6162 async def get(63 self,Finessing interfaceTom Christiebefore adoptiond7619a9
line 64why, one step back64 url: URLTypes,Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
line 65why, one step back65 *,query_params -> paramsTom Christiebefore adoptionbb70377
line 66why, one step back66 params: QueryParamTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
line 67why, one step back67 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 68why, one step back68 cookies: CookieTypes = None,Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
line 69why, one step back69 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 70why, one step back70 auth: AuthTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
line 71why, one step back71 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 72–74why, one step back72 cert: CertTypes = None,73 verify: VerifyTypes = None,74 timeout: TimeoutTypes = None,Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
lines 75–76why, one step back75 ) -> Response:76 return await self.request(Finessing interfaceTom Christiebefore adoptiond7619a9
lines 77–78why, one step back77 "GET",78 url,query_params -> paramsTom Christiebefore adoptionbb70377
line 79why, one step back79 params=params,Finessing interfaceTom Christiebefore adoptiond7619a9
line 80why, one step back80 headers=headers,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 81why, one step back81 cookies=cookies,Finessing interfaceTom Christiebefore adoptiond7619a9
line 82why, one step back82 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 83why, one step back83 auth=auth,Finessing interfaceTom Christiebefore adoptiond7619a9
line 84why, one step back84 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 85–86why, one step back85 verify=verify,86 cert=cert,Finessing interfaceTom Christiebefore adoptiond7619a9
line 87why, one step back87 timeout=timeout,Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
lines 88–89why, one step back88 )89Finessing interfaceTom Christiebefore adoptiond7619a9
lines 90–93why, one step back90 async def options(91 self,92 url: URLTypes,93 *,query_params -> paramsTom Christiebefore adoptionbb70377
line 94why, one step back94 params: QueryParamTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
line 95why, one step back95 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 96why, one step back96 cookies: CookieTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
line 97why, one step back97 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 98why, one step back98 auth: AuthTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
line 99why, one step back99 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 100–102why, one step back100 cert: CertTypes = None,101 verify: VerifyTypes = None,102 timeout: TimeoutTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
lines 103–106why, one step back103 ) -> Response:104 return await self.request(105 "OPTIONS",106 url,query_params -> paramsTom Christiebefore adoptionbb70377
line 107why, one step back107 params=params,Finessing interfaceTom Christiebefore adoptiond7619a9
line 108why, one step back108 headers=headers,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 109why, one step back109 cookies=cookies,Finessing interfaceTom Christiebefore adoptiond7619a9
line 110why, one step back110 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 111why, one step back111 auth=auth,Finessing interfaceTom Christiebefore adoptiond7619a9
line 112why, one step back112 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 113–114why, one step back113 verify=verify,114 cert=cert,Finessing interfaceTom Christiebefore adoptiond7619a9
lines 115–121why, one step back115 timeout=timeout,116 )117118 async def head(119 self,120 url: URLTypes,121 *,query_params -> paramsTom Christiebefore adoptionbb70377
line 122why, one step back122 params: QueryParamTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
line 123why, one step back123 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 124why, one step back124 cookies: CookieTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
line 125why, one step back125 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 126why, one step back126 auth: AuthTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
line 127why, one step back127 allow_redirects: bool = False, # Note: Differs to usual default.Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 128–130why, one step back128 cert: CertTypes = None,129 verify: VerifyTypes = None,130 timeout: TimeoutTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
lines 131–134why, one step back131 ) -> Response:132 return await self.request(133 "HEAD",134 url,query_params -> paramsTom Christiebefore adoptionbb70377
line 135why, one step back135 params=params,Finessing interfaceTom Christiebefore adoptiond7619a9
line 136why, one step back136 headers=headers,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 137why, one step back137 cookies=cookies,Finessing interfaceTom Christiebefore adoptiond7619a9
line 138why, one step back138 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 139why, one step back139 auth=auth,Finessing interfaceTom Christiebefore adoptiond7619a9
line 140why, one step back140 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 141–142why, one step back141 verify=verify,142 cert=cert,Finessing interfaceTom Christiebefore adoptiond7619a9
lines 143–145why, one step back143 timeout=timeout,144 )145Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
lines 146–147why, one step back146 async def post(147 self,Finessing interfaceTom Christiebefore adoptiond7619a9
line 148why, one step back148 url: URLTypes,Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
line 149why, one step back149 *,Merge pull request #44 from encode/request-dataTom Christiebefore adoption39a5c53
line 150why, one step back150 data: RequestData = b"",Add json interfacesTom Christiebefore adoption5a63d31
line 151why, one step back151 json: typing.Any = None,query_params -> paramsTom Christiebefore adoptionbb70377
line 152why, one step back152 params: QueryParamTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
line 153why, one step back153 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 154why, one step back154 cookies: CookieTypes = None,Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
line 155why, one step back155 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 156why, one step back156 auth: AuthTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
line 157why, one step back157 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 158–160why, one step back158 cert: CertTypes = None,159 verify: VerifyTypes = None,160 timeout: TimeoutTypes = None,Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
lines 161–164why, one step back161 ) -> Response:162 return await self.request(163 "POST",164 url,Merge pull request #44 from encode/request-dataTom Christiebefore adoption39a5c53
line 165why, one step back165 data=data,Add json interfacesTom Christiebefore adoption5a63d31
line 166why, one step back166 json=json,query_params -> paramsTom Christiebefore adoptionbb70377
line 167why, one step back167 params=params,Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
line 168why, one step back168 headers=headers,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 169why, one step back169 cookies=cookies,Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
line 170why, one step back170 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 171why, one step back171 auth=auth,Finessing interfaceTom Christiebefore adoptiond7619a9
line 172why, one step back172 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 173–174why, one step back173 verify=verify,174 cert=cert,Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
lines 175–177why, one step back175 timeout=timeout,176 )177Finessing interfaceTom Christiebefore adoptiond7619a9
lines 178–181why, one step back178 async def put(179 self,180 url: URLTypes,181 *,Merge pull request #44 from encode/request-dataTom Christiebefore adoption39a5c53
line 182why, one step back182 data: RequestData = b"",Add json interfacesTom Christiebefore adoption5a63d31
line 183why, one step back183 json: typing.Any = None,query_params -> paramsTom Christiebefore adoptionbb70377
line 184why, one step back184 params: QueryParamTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
line 185why, one step back185 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 186why, one step back186 cookies: CookieTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
line 187why, one step back187 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 188why, one step back188 auth: AuthTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
line 189why, one step back189 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 190–192why, one step back190 cert: CertTypes = None,191 verify: VerifyTypes = None,192 timeout: TimeoutTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
lines 193–196why, one step back193 ) -> Response:194 return await self.request(195 "PUT",196 url,Merge pull request #44 from encode/request-dataTom Christiebefore adoption39a5c53
line 197why, one step back197 data=data,Add json interfacesTom Christiebefore adoption5a63d31
line 198why, one step back198 json=json,query_params -> paramsTom Christiebefore adoptionbb70377
line 199why, one step back199 params=params,Finessing interfaceTom Christiebefore adoptiond7619a9
line 200why, one step back200 headers=headers,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 201why, one step back201 cookies=cookies,Finessing interfaceTom Christiebefore adoptiond7619a9
line 202why, one step back202 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 203why, one step back203 auth=auth,Finessing interfaceTom Christiebefore adoptiond7619a9
line 204why, one step back204 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 205–206why, one step back205 verify=verify,206 cert=cert,Finessing interfaceTom Christiebefore adoptiond7619a9
lines 207–213why, one step back207 timeout=timeout,208 )209210 async def patch(211 self,212 url: URLTypes,213 *,Merge pull request #44 from encode/request-dataTom Christiebefore adoption39a5c53
line 214why, one step back214 data: RequestData = b"",Add json interfacesTom Christiebefore adoption5a63d31
line 215why, one step back215 json: typing.Any = None,query_params -> paramsTom Christiebefore adoptionbb70377
line 216why, one step back216 params: QueryParamTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
line 217why, one step back217 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 218why, one step back218 cookies: CookieTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
line 219why, one step back219 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 220why, one step back220 auth: AuthTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
line 221why, one step back221 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 222–224why, one step back222 cert: CertTypes = None,223 verify: VerifyTypes = None,224 timeout: TimeoutTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
lines 225–228why, one step back225 ) -> Response:226 return await self.request(227 "PATCH",228 url,Merge pull request #44 from encode/request-dataTom Christiebefore adoption39a5c53
line 229why, one step back229 data=data,Add json interfacesTom Christiebefore adoption5a63d31
line 230why, one step back230 json=json,query_params -> paramsTom Christiebefore adoptionbb70377
line 231why, one step back231 params=params,Finessing interfaceTom Christiebefore adoptiond7619a9
line 232why, one step back232 headers=headers,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 233why, one step back233 cookies=cookies,Finessing interfaceTom Christiebefore adoptiond7619a9
line 234why, one step back234 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 235why, one step back235 auth=auth,Finessing interfaceTom Christiebefore adoptiond7619a9
line 236why, one step back236 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 237–238why, one step back237 verify=verify,238 cert=cert,Finessing interfaceTom Christiebefore adoptiond7619a9
lines 239–245why, one step back239 timeout=timeout,240 )241242 async def delete(243 self,244 url: URLTypes,245 *,Merge pull request #44 from encode/request-dataTom Christiebefore adoption39a5c53
line 246why, one step back246 data: RequestData = b"",Add json interfacesTom Christiebefore adoption5a63d31
line 247why, one step back247 json: typing.Any = None,query_params -> paramsTom Christiebefore adoptionbb70377
line 248why, one step back248 params: QueryParamTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
line 249why, one step back249 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 250why, one step back250 cookies: CookieTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
line 251why, one step back251 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 252why, one step back252 auth: AuthTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
line 253why, one step back253 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 254–256why, one step back254 cert: CertTypes = None,255 verify: VerifyTypes = None,256 timeout: TimeoutTypes = None,Finessing interfaceTom Christiebefore adoptiond7619a9
lines 257–260why, one step back257 ) -> Response:258 return await self.request(259 "DELETE",260 url,Merge pull request #44 from encode/request-dataTom Christiebefore adoption39a5c53
line 261why, one step back261 data=data,Add json interfacesTom Christiebefore adoption5a63d31
line 262why, one step back262 json=json,query_params -> paramsTom Christiebefore adoptionbb70377
line 263why, one step back263 params=params,Finessing interfaceTom Christiebefore adoptiond7619a9
line 264why, one step back264 headers=headers,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 265why, one step back265 cookies=cookies,Finessing interfaceTom Christiebefore adoptiond7619a9
line 266why, one step back266 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 267why, one step back267 auth=auth,Finessing interfaceTom Christiebefore adoptiond7619a9
line 268why, one step back268 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 269–270why, one step back269 verify=verify,270 cert=cert,Finessing interfaceTom Christiebefore adoptiond7619a9
lines 271–273why, one step back271 timeout=timeout,272 )273Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 274–279why, one step back274 async def request(275 self,276 method: str,277 url: URLTypes,278 *,279 data: RequestData = b"",Add json interfacesTom Christiebefore adoption5a63d31
line 280why, one step back280 json: typing.Any = None,query_params -> paramsTom Christiebefore adoptionbb70377
line 281why, one step back281 params: QueryParamTypes = None,Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 282why, one step back282 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 283why, one step back283 cookies: CookieTypes = None,Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 284why, one step back284 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 285why, one step back285 auth: AuthTypes = None,Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 286why, one step back286 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 287–289why, one step back287 cert: CertTypes = None,288 verify: VerifyTypes = None,289 timeout: TimeoutTypes = None,Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 290–291why, one step back290 ) -> Response:291 request = Request(Cookie support (#73)Tom Christiebefore adoptionfeae0a8
lines 292–294why, one step back292 method,293 url,294 data=data,Add json interfacesTom Christiebefore adoption5a63d31
line 295why, one step back295 json=json,query_params -> paramsTom Christiebefore adoptionbb70377
line 296why, one step back296 params=params,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
lines 297–298why, one step back297 headers=headers,298 cookies=self.merge_cookies(cookies),Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 299–302why, one step back299 )300 response = await self.send(301 request,302 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 303why, one step back303 auth=auth,Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 304why, one step back304 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 305–306why, one step back305 verify=verify,306 cert=cert,Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 307–310why, one step back307 timeout=timeout,308 )309 return response310query_params -> paramsTom Christiebefore adoptionbb70377
lines 311–313why, one step back311 def merge_cookies(312 self, cookies: CookieTypes = None313 ) -> typing.Optional[CookieTypes]:Cookie support (#73)Tom Christiebefore adoptionfeae0a8
lines 314–319why, one step back314 if cookies or self.cookies:315 merged_cookies = Cookies(self.cookies)316 merged_cookies.update(cookies)317 return merged_cookies318 return cookies319Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
lines 320–324why, one step back320 async def send(321 self,322 request: Request,323 *,324 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 325why, one step back325 auth: AuthTypes = None,Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 326why, one step back326 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 327–329why, one step back327 verify: VerifyTypes = None,328 cert: CertTypes = None,329 timeout: TimeoutTypes = None,Auth (#65)Tom Christiebefore adoption5afa7dd
lines 330–345why, one step back330 ) -> Response:331 if auth is None:332 auth = self.auth333334 url = request.url335 if auth is None and (url.username or url.password):336 auth = HTTPBasicAuth(username=url.username, password=url.password)337338 if auth is not None:339 if isinstance(auth, tuple):340 auth = HTTPBasicAuth(username=auth[0], password=auth[1])341 request = auth(request)342343 response = await self.send_handling_redirects(344 request,345 stream=stream,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 346–347why, one step back346 verify=verify,347 cert=cert,Auth (#65)Tom Christiebefore adoption5afa7dd
lines 348–357why, one step back348 timeout=timeout,349 allow_redirects=allow_redirects,350 )351 return response352353 async def send_handling_redirects(354 self,355 request: Request,356 *,357 stream: bool = False,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 358–360why, one step back358 cert: CertTypes = None,359 verify: VerifyTypes = None,360 timeout: TimeoutTypes = None,Auth (#65)Tom Christiebefore adoption5afa7dd
line 361why, one step back361 allow_redirects: bool = True,Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 362why, one step back362 history: typing.List[Response] = None,Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
line 363why, one step back363 ) -> Response:Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 364–365why, one step back364 if history is None:365 history = []Finessing interfaceTom Christiebefore adoptiond7619a9
line 366why, one step back366Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 367–373why, one step back367 while True:368 # We perform these checks here, so that calls to `response.next()`369 # will raise redirect errors if appropriate.370 if len(history) > self.max_redirects:371 raise TooManyRedirects()372 if request.url in [response.url for response in history]:373 raise RedirectLoop()Finessing interfaceTom Christiebefore adoptiond7619a9
line 374why, one step back374Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 375why, one step back375 response = await self.dispatch.send(Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
line 376why, one step back376 request, stream=stream, verify=verify, cert=cert, timeout=timeoutMerge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 377–378why, one step back377 )378 response.history = list(history)Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 379why, one step back379 self.cookies.extract_cookies(response)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 380–382why, one step back380 history = [response] + history381 if not response.is_redirect:382 breakMerge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
line 383why, one step back383Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 384–388why, one step back384 if allow_redirects:385 request = self.build_redirect_request(request, response)386 else:387388 async def send_next() -> Response:Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
line 389why, one step back389 nonlocal request, response, verify, cert, allow_redirects, timeout, historyMerge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 390why, one step back390 request = self.build_redirect_request(request, response)Auth (#65)Tom Christiebefore adoption5afa7dd
line 391why, one step back391 response = await self.send_handling_redirects(Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 392–394why, one step back392 request,393 stream=stream,394 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 395–396why, one step back395 verify=verify,396 cert=cert,Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 397–411why, one step back397 timeout=timeout,398 history=history,399 )400 return response401402 response.next = send_next # type: ignore403 break404405 return response406407 def build_redirect_request(self, request: Request, response: Response) -> Request:408 method = self.redirect_method(request, response)409 url = self.redirect_url(request, response)410 headers = self.redirect_headers(request, url)411 content = self.redirect_content(request, method)Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 412why, one step back412 cookies = self.merge_cookies(request.cookies)query_params -> paramsTom Christiebefore adoptionbb70377
lines 413–415why, one step back413 return Request(414 method=method, url=url, headers=headers, data=content, cookies=cookies415 )Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 416–424why, one step back416417 def redirect_method(self, request: Request, response: Response) -> str:418 """419 When being redirected we may want to change the method of the request420 based on certain specs or browser behavior.421 """422 method = request.method423424 # https://tools.ietf.org/html/rfc7231#section-6.4.4Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369
line 425why, one step back425 if response.status_code == codes.SEE_OTHER and method != "HEAD":Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 426–429why, one step back426 method = "GET"427428 # Do what the browsers do, despite standards...429 # Turn 302s into GETs.Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369
line 430why, one step back430 if response.status_code == codes.FOUND and method != "HEAD":Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 431–434why, one step back431 method = "GET"432433 # If a POST is responded to with a 301, turn it into a GET.434 # This bizarre behaviour is explained in 'requests' issue 1704.Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369
line 435why, one step back435 if response.status_code == codes.MOVED_PERMANENTLY and method == "POST":Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 436–478why, one step back436 method = "GET"437438 return method439440 def redirect_url(self, request: Request, response: Response) -> URL:441 """442 Return the URL for the redirect to follow.443 """444 location = response.headers["Location"]445446 url = URL(location, allow_relative=True)447448 # Facilitate relative 'Location' headers, as allowed by RFC 7231.449 # (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource')450 if url.is_relative_url:451 url = url.resolve_with(request.url)452453 # Attach previous fragment if needed (RFC 7231 7.1.2)454 if request.url.fragment and not url.fragment:455 url = url.copy_with(fragment=request.url.fragment)456457 return url458459 def redirect_headers(self, request: Request, url: URL) -> Headers:460 """461 Strip Authorization headers when responses are redirected away from462 the origin.463 """464 headers = Headers(request.headers)465 if url.origin != request.url.origin:466 del headers["Authorization"]467 return headers468469 def redirect_content(self, request: Request, method: str) -> bytes:470 """471 Return the body that should be used for the redirect request.472 """473 if method != request.method and method == "GET":474 return b""475 if request.is_streaming:476 raise RedirectBodyUnavailable()477 return request.content478Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
line 479why, one step back479 async def close(self) -> None:Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 480why, one step back480 await self.dispatch.close()Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
line 481why, one step back481Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 482why, one step back482 async def __aenter__(self) -> "AsyncClient":Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
lines 483–491why, one step back483 return self484485 async def __aexit__(486 self,487 exc_type: typing.Type[BaseException] = None,488 exc_value: BaseException = None,489 traceback: TracebackType = None,490 ) -> None:491 await self.close()Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 492–496why, one step back492493494class Client:495 def __init__(496 self,Auth (#65)Tom Christiebefore adoption5afa7dd
line 497why, one step back497 auth: AuthTypes = None,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 498–500why, one step back498 cert: CertTypes = None,499 verify: VerifyTypes = True,500 timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 501–503why, one step back501 pool_limits: PoolLimits = DEFAULT_POOL_LIMITS,502 max_redirects: int = DEFAULT_MAX_REDIRECTS,503 dispatch: Dispatcher = None,Merge pull request #60 from encode/concurrency-backend-classTom Christiebefore adoption3d997af
line 504why, one step back504 backend: ConcurrencyBackend = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 505–506why, one step back505 ) -> None:506 self._client = AsyncClient(Auth (#65)Tom Christiebefore adoption5afa7dd
line 507why, one step back507 auth=auth,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 508–509why, one step back508 verify=verify,509 cert=cert,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 510–513why, one step back510 timeout=timeout,511 pool_limits=pool_limits,512 max_redirects=max_redirects,513 dispatch=dispatch,Merge pull request #60 from encode/concurrency-backend-classTom Christiebefore adoption3d997af
line 514why, one step back514 backend=backend,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 515–517why, one step back515 )516 self._loop = asyncio.new_event_loop()517Cookie support (#73)Tom Christiebefore adoptionfeae0a8
lines 518–521why, one step back518 @property519 def cookies(self) -> Cookies:520 return self._client.cookies521Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 522–527why, one step back522 def request(523 self,524 method: str,525 url: URLTypes,526 *,527 data: RequestData = b"",Add json interfacesTom Christiebefore adoption5a63d31
line 528why, one step back528 json: typing.Any = None,query_params -> paramsTom Christiebefore adoptionbb70377
line 529why, one step back529 params: QueryParamTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 530why, one step back530 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 531why, one step back531 cookies: CookieTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 532why, one step back532 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 533why, one step back533 auth: AuthTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 534why, one step back534 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 535–537why, one step back535 cert: CertTypes = None,536 verify: VerifyTypes = None,537 timeout: TimeoutTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 538–539why, one step back538 ) -> SyncResponse:539 request = Request(Cookie support (#73)Tom Christiebefore adoptionfeae0a8
lines 540–542why, one step back540 method,541 url,542 data=data,Add json interfacesTom Christiebefore adoption5a63d31
line 543why, one step back543 json=json,query_params -> paramsTom Christiebefore adoptionbb70377
line 544why, one step back544 params=params,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
lines 545–546why, one step back545 headers=headers,546 cookies=self._client.merge_cookies(cookies),Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 547–550why, one step back547 )548 response = self.send(549 request,550 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 551why, one step back551 auth=auth,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 552why, one step back552 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 553–554why, one step back553 verify=verify,554 cert=cert,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 555–562why, one step back555 timeout=timeout,556 )557 return response558559 def get(560 self,561 url: URLTypes,562 *,query_params -> paramsTom Christiebefore adoptionbb70377
line 563why, one step back563 params: QueryParamTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 564why, one step back564 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 565why, one step back565 cookies: CookieTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 566why, one step back566 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 567why, one step back567 auth: AuthTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 568why, one step back568 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 569–571why, one step back569 cert: CertTypes = None,570 verify: VerifyTypes = None,571 timeout: TimeoutTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 572–576why, one step back572 ) -> SyncResponse:573 return self.request(574 "GET",575 url,576 headers=headers,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 577why, one step back577 cookies=cookies,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 578why, one step back578 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 579why, one step back579 auth=auth,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 580why, one step back580 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 581–582why, one step back581 verify=verify,582 cert=cert,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 583–589why, one step back583 timeout=timeout,584 )585586 def options(587 self,588 url: URLTypes,589 *,query_params -> paramsTom Christiebefore adoptionbb70377
line 590why, one step back590 params: QueryParamTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 591why, one step back591 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 592why, one step back592 cookies: CookieTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 593why, one step back593 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 594why, one step back594 auth: AuthTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 595why, one step back595 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 596–598why, one step back596 cert: CertTypes = None,597 verify: VerifyTypes = None,598 timeout: TimeoutTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 599–603why, one step back599 ) -> SyncResponse:600 return self.request(601 "OPTIONS",602 url,603 headers=headers,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 604why, one step back604 cookies=cookies,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 605why, one step back605 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 606why, one step back606 auth=auth,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 607why, one step back607 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 608–609why, one step back608 verify=verify,609 cert=cert,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 610–616why, one step back610 timeout=timeout,611 )612613 def head(614 self,615 url: URLTypes,616 *,query_params -> paramsTom Christiebefore adoptionbb70377
line 617why, one step back617 params: QueryParamTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 618why, one step back618 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 619why, one step back619 cookies: CookieTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 620why, one step back620 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 621why, one step back621 auth: AuthTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 622why, one step back622 allow_redirects: bool = False, # Note: Differs to usual default.Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 623–625why, one step back623 cert: CertTypes = None,624 verify: VerifyTypes = None,625 timeout: TimeoutTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 626–630why, one step back626 ) -> SyncResponse:627 return self.request(628 "HEAD",629 url,630 headers=headers,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 631why, one step back631 cookies=cookies,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 632why, one step back632 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 633why, one step back633 auth=auth,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 634why, one step back634 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 635–636why, one step back635 verify=verify,636 cert=cert,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 637–644why, one step back637 timeout=timeout,638 )639640 def post(641 self,642 url: URLTypes,643 *,644 data: RequestData = b"",Add json interfacesTom Christiebefore adoption5a63d31
line 645why, one step back645 json: typing.Any = None,query_params -> paramsTom Christiebefore adoptionbb70377
line 646why, one step back646 params: QueryParamTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 647why, one step back647 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 648why, one step back648 cookies: CookieTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 649why, one step back649 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 650why, one step back650 auth: AuthTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 651why, one step back651 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 652–654why, one step back652 cert: CertTypes = None,653 verify: VerifyTypes = None,654 timeout: TimeoutTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 655–659why, one step back655 ) -> SyncResponse:656 return self.request(657 "POST",658 url,659 data=data,Add json interfacesTom Christiebefore adoption5a63d31
line 660why, one step back660 json=json,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 661why, one step back661 headers=headers,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 662why, one step back662 cookies=cookies,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 663why, one step back663 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 664why, one step back664 auth=auth,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 665why, one step back665 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 666–667why, one step back666 verify=verify,667 cert=cert,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 668–675why, one step back668 timeout=timeout,669 )670671 def put(672 self,673 url: URLTypes,674 *,675 data: RequestData = b"",Add json interfacesTom Christiebefore adoption5a63d31
line 676why, one step back676 json: typing.Any = None,query_params -> paramsTom Christiebefore adoptionbb70377
line 677why, one step back677 params: QueryParamTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 678why, one step back678 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 679why, one step back679 cookies: CookieTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 680why, one step back680 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 681why, one step back681 auth: AuthTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 682why, one step back682 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 683–685why, one step back683 cert: CertTypes = None,684 verify: VerifyTypes = None,685 timeout: TimeoutTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 686–690why, one step back686 ) -> SyncResponse:687 return self.request(688 "PUT",689 url,690 data=data,Add json interfacesTom Christiebefore adoption5a63d31
line 691why, one step back691 json=json,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 692why, one step back692 headers=headers,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 693why, one step back693 cookies=cookies,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 694why, one step back694 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 695why, one step back695 auth=auth,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 696why, one step back696 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 697–698why, one step back697 verify=verify,698 cert=cert,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 699–706why, one step back699 timeout=timeout,700 )701702 def patch(703 self,704 url: URLTypes,705 *,706 data: RequestData = b"",Add json interfacesTom Christiebefore adoption5a63d31
line 707why, one step back707 json: typing.Any = None,query_params -> paramsTom Christiebefore adoptionbb70377
line 708why, one step back708 params: QueryParamTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 709why, one step back709 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 710why, one step back710 cookies: CookieTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 711why, one step back711 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 712why, one step back712 auth: AuthTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 713why, one step back713 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 714–716why, one step back714 cert: CertTypes = None,715 verify: VerifyTypes = None,716 timeout: TimeoutTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 717–721why, one step back717 ) -> SyncResponse:718 return self.request(719 "PATCH",720 url,721 data=data,Add json interfacesTom Christiebefore adoption5a63d31
line 722why, one step back722 json=json,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 723why, one step back723 headers=headers,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 724why, one step back724 cookies=cookies,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 725why, one step back725 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 726why, one step back726 auth=auth,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 727why, one step back727 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 728–729why, one step back728 verify=verify,729 cert=cert,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 730–737why, one step back730 timeout=timeout,731 )732733 def delete(734 self,735 url: URLTypes,736 *,737 data: RequestData = b"",Add json interfacesTom Christiebefore adoption5a63d31
line 738why, one step back738 json: typing.Any = None,query_params -> paramsTom Christiebefore adoptionbb70377
line 739why, one step back739 params: QueryParamTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 740why, one step back740 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 741why, one step back741 cookies: CookieTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 742why, one step back742 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 743why, one step back743 auth: AuthTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 744why, one step back744 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 745–747why, one step back745 cert: CertTypes = None,746 verify: VerifyTypes = None,747 timeout: TimeoutTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 748–752why, one step back748 ) -> SyncResponse:749 return self.request(750 "DELETE",751 url,752 data=data,Add json interfacesTom Christiebefore adoption5a63d31
line 753why, one step back753 json=json,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 754why, one step back754 headers=headers,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 755why, one step back755 cookies=cookies,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 756why, one step back756 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 757why, one step back757 auth=auth,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 758why, one step back758 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 759–760why, one step back759 verify=verify,760 cert=cert,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 761–768why, one step back761 timeout=timeout,762 )763764 def send(765 self,766 request: Request,767 *,768 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 769why, one step back769 auth: AuthTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 770why, one step back770 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 771–773why, one step back771 verify: VerifyTypes = None,772 cert: CertTypes = None,773 timeout: TimeoutTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 774–778why, one step back774 ) -> SyncResponse:775 response = self._loop.run_until_complete(776 self._client.send(777 request,778 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 779why, one step back779 auth=auth,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 780why, one step back780 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 781–782why, one step back781 verify=verify,782 cert=cert,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 783–800why, one step back783 timeout=timeout,784 )785 )786 return SyncResponse(response, self._loop)787788 def close(self) -> None:789 self._loop.run_until_complete(self._client.close())790791 def __enter__(self) -> "Client":792 return self793794 def __exit__(795 self,796 exc_type: typing.Type[BaseException] = None,797 exc_value: BaseException = None,798 traceback: TracebackType = None,799 ) -> None:800 self.close()