client.py
This file
Path
httpcore/client.py
808 lines · 22.6 KiB · Python
Last changed by
Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
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–303why, one step back299 )300 self.prepare_request(request)301 response = await self.send(302 request,303 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 304why, one step back304 auth=auth,Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 305why, one step back305 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 306–307why, one step back306 verify=verify,307 cert=cert,Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 308–311why, one step back308 timeout=timeout,309 )310 return response311Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
line 312why, one step back312 def prepare_request(self, request: Request) -> None:Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 313why, one step back313 request.prepare()Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
line 314why, one step back314query_params -> paramsTom Christiebefore adoptionbb70377
lines 315–317why, one step back315 def merge_cookies(316 self, cookies: CookieTypes = None317 ) -> typing.Optional[CookieTypes]:Cookie support (#73)Tom Christiebefore adoptionfeae0a8
lines 318–323why, one step back318 if cookies or self.cookies:319 merged_cookies = Cookies(self.cookies)320 merged_cookies.update(cookies)321 return merged_cookies322 return cookies323Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
lines 324–328why, one step back324 async def send(325 self,326 request: Request,327 *,328 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 329why, one step back329 auth: AuthTypes = None,Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 330why, one step back330 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 331–333why, one step back331 verify: VerifyTypes = None,332 cert: CertTypes = None,333 timeout: TimeoutTypes = None,Auth (#65)Tom Christiebefore adoption5afa7dd
lines 334–349why, one step back334 ) -> Response:335 if auth is None:336 auth = self.auth337338 url = request.url339 if auth is None and (url.username or url.password):340 auth = HTTPBasicAuth(username=url.username, password=url.password)341342 if auth is not None:343 if isinstance(auth, tuple):344 auth = HTTPBasicAuth(username=auth[0], password=auth[1])345 request = auth(request)346347 response = await self.send_handling_redirects(348 request,349 stream=stream,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 350–351why, one step back350 verify=verify,351 cert=cert,Auth (#65)Tom Christiebefore adoption5afa7dd
lines 352–361why, one step back352 timeout=timeout,353 allow_redirects=allow_redirects,354 )355 return response356357 async def send_handling_redirects(358 self,359 request: Request,360 *,361 stream: bool = False,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 362–364why, one step back362 cert: CertTypes = None,363 verify: VerifyTypes = None,364 timeout: TimeoutTypes = None,Auth (#65)Tom Christiebefore adoption5afa7dd
line 365why, one step back365 allow_redirects: bool = True,Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 366why, one step back366 history: typing.List[Response] = None,Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
line 367why, one step back367 ) -> Response:Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 368–369why, one step back368 if history is None:369 history = []Finessing interfaceTom Christiebefore adoptiond7619a9
line 370why, one step back370Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 371–377why, one step back371 while True:372 # We perform these checks here, so that calls to `response.next()`373 # will raise redirect errors if appropriate.374 if len(history) > self.max_redirects:375 raise TooManyRedirects()376 if request.url in [response.url for response in history]:377 raise RedirectLoop()Finessing interfaceTom Christiebefore adoptiond7619a9
line 378why, one step back378Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 379why, one step back379 response = await self.dispatch.send(Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
line 380why, one step back380 request, stream=stream, verify=verify, cert=cert, timeout=timeoutMerge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 381–382why, one step back381 )382 response.history = list(history)Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 383why, one step back383 self.cookies.extract_cookies(response)Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 384–386why, one step back384 history = [response] + history385 if not response.is_redirect:386 breakMerge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
line 387why, one step back387Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 388–392why, one step back388 if allow_redirects:389 request = self.build_redirect_request(request, response)390 else:391392 async def send_next() -> Response:Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
line 393why, one step back393 nonlocal request, response, verify, cert, allow_redirects, timeout, historyMerge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 394why, one step back394 request = self.build_redirect_request(request, response)Auth (#65)Tom Christiebefore adoption5afa7dd
line 395why, one step back395 response = await self.send_handling_redirects(Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 396–398why, one step back396 request,397 stream=stream,398 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 399–400why, one step back399 verify=verify,400 cert=cert,Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 401–415why, one step back401 timeout=timeout,402 history=history,403 )404 return response405406 response.next = send_next # type: ignore407 break408409 return response410411 def build_redirect_request(self, request: Request, response: Response) -> Request:412 method = self.redirect_method(request, response)413 url = self.redirect_url(request, response)414 headers = self.redirect_headers(request, url)415 content = self.redirect_content(request, method)Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 416why, one step back416 cookies = self.merge_cookies(request.cookies)query_params -> paramsTom Christiebefore adoptionbb70377
lines 417–419why, one step back417 return Request(418 method=method, url=url, headers=headers, data=content, cookies=cookies419 )Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 420–428why, one step back420421 def redirect_method(self, request: Request, response: Response) -> str:422 """423 When being redirected we may want to change the method of the request424 based on certain specs or browser behavior.425 """426 method = request.method427428 # https://tools.ietf.org/html/rfc7231#section-6.4.4Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369
line 429why, one step back429 if response.status_code == codes.SEE_OTHER and method != "HEAD":Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 430–433why, one step back430 method = "GET"431432 # Do what the browsers do, despite standards...433 # Turn 302s into GETs.Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369
line 434why, one step back434 if response.status_code == codes.FOUND and method != "HEAD":Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 435–438why, one step back435 method = "GET"436437 # If a POST is responded to with a 301, turn it into a GET.438 # This bizarre behaviour is explained in 'requests' issue 1704.Merge pull request #59 from encode/use-stdlib-status-codesTom Christiebefore adoptionafc8369
line 439why, one step back439 if response.status_code == codes.MOVED_PERMANENTLY and method == "POST":Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
lines 440–482why, one step back440 method = "GET"441442 return method443444 def redirect_url(self, request: Request, response: Response) -> URL:445 """446 Return the URL for the redirect to follow.447 """448 location = response.headers["Location"]449450 url = URL(location, allow_relative=True)451452 # Facilitate relative 'Location' headers, as allowed by RFC 7231.453 # (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource')454 if url.is_relative_url:455 url = url.resolve_with(request.url)456457 # Attach previous fragment if needed (RFC 7231 7.1.2)458 if request.url.fragment and not url.fragment:459 url = url.copy_with(fragment=request.url.fragment)460461 return url462463 def redirect_headers(self, request: Request, url: URL) -> Headers:464 """465 Strip Authorization headers when responses are redirected away from466 the origin.467 """468 headers = Headers(request.headers)469 if url.origin != request.url.origin:470 del headers["Authorization"]471 return headers472473 def redirect_content(self, request: Request, method: str) -> bytes:474 """475 Return the body that should be used for the redirect request.476 """477 if method != request.method and method == "GET":478 return b""479 if request.is_streaming:480 raise RedirectBodyUnavailable()481 return request.content482Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
line 483why, one step back483 async def close(self) -> None:Merge pull request #55 from encode/drop-adaptersTom Christiebefore adoptiond72a144
line 484why, one step back484 await self.dispatch.close()Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
line 485why, one step back485Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 486why, one step back486 async def __aenter__(self) -> "AsyncClient":Merge pull request #23 from encode/adaptersTom Christiebefore adoption696c054
lines 487–495why, one step back487 return self488489 async def __aexit__(490 self,491 exc_type: typing.Type[BaseException] = None,492 exc_value: BaseException = None,493 traceback: TracebackType = None,494 ) -> None:495 await self.close()Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 496–500why, one step back496497498class Client:499 def __init__(500 self,Auth (#65)Tom Christiebefore adoption5afa7dd
line 501why, one step back501 auth: AuthTypes = None,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 502–504why, one step back502 cert: CertTypes = None,503 verify: VerifyTypes = True,504 timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 505–507why, one step back505 pool_limits: PoolLimits = DEFAULT_POOL_LIMITS,506 max_redirects: int = DEFAULT_MAX_REDIRECTS,507 dispatch: Dispatcher = None,Merge pull request #60 from encode/concurrency-backend-classTom Christiebefore adoption3d997af
line 508why, one step back508 backend: ConcurrencyBackend = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 509–510why, one step back509 ) -> None:510 self._client = AsyncClient(Auth (#65)Tom Christiebefore adoption5afa7dd
line 511why, one step back511 auth=auth,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 512–513why, one step back512 verify=verify,513 cert=cert,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 514–517why, one step back514 timeout=timeout,515 pool_limits=pool_limits,516 max_redirects=max_redirects,517 dispatch=dispatch,Merge pull request #60 from encode/concurrency-backend-classTom Christiebefore adoption3d997af
line 518why, one step back518 backend=backend,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 519–521why, one step back519 )520 self._loop = asyncio.new_event_loop()521Cookie support (#73)Tom Christiebefore adoptionfeae0a8
lines 522–525why, one step back522 @property523 def cookies(self) -> Cookies:524 return self._client.cookies525Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 526–531why, one step back526 def request(527 self,528 method: str,529 url: URLTypes,530 *,531 data: RequestData = b"",Add json interfacesTom Christiebefore adoption5a63d31
line 532why, one step back532 json: typing.Any = None,query_params -> paramsTom Christiebefore adoptionbb70377
line 533why, one step back533 params: QueryParamTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 534why, one step back534 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 535why, one step back535 cookies: CookieTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 536why, one step back536 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 537why, one step back537 auth: AuthTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 538why, one step back538 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 539–541why, one step back539 cert: CertTypes = None,540 verify: VerifyTypes = None,541 timeout: TimeoutTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 542–543why, one step back542 ) -> SyncResponse:543 request = Request(Cookie support (#73)Tom Christiebefore adoptionfeae0a8
lines 544–546why, one step back544 method,545 url,546 data=data,Add json interfacesTom Christiebefore adoption5a63d31
line 547why, one step back547 json=json,query_params -> paramsTom Christiebefore adoptionbb70377
line 548why, one step back548 params=params,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
lines 549–550why, one step back549 headers=headers,550 cookies=self._client.merge_cookies(cookies),Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 551–555why, one step back551 )552 self.prepare_request(request)553 response = self.send(554 request,555 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 556why, one step back556 auth=auth,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 557why, one step back557 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 558–559why, one step back558 verify=verify,559 cert=cert,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 560–567why, one step back560 timeout=timeout,561 )562 return response563564 def get(565 self,566 url: URLTypes,567 *,query_params -> paramsTom Christiebefore adoptionbb70377
line 568why, one step back568 params: QueryParamTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 569why, one step back569 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 570why, one step back570 cookies: CookieTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 571why, one step back571 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 572why, one step back572 auth: AuthTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 573why, one step back573 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 574–576why, one step back574 cert: CertTypes = None,575 verify: VerifyTypes = None,576 timeout: TimeoutTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 577–581why, one step back577 ) -> SyncResponse:578 return self.request(579 "GET",580 url,581 headers=headers,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 582why, one step back582 cookies=cookies,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 583why, one step back583 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 584why, one step back584 auth=auth,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 585why, one step back585 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 586–587why, one step back586 verify=verify,587 cert=cert,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 588–594why, one step back588 timeout=timeout,589 )590591 def options(592 self,593 url: URLTypes,594 *,query_params -> paramsTom Christiebefore adoptionbb70377
line 595why, one step back595 params: QueryParamTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 596why, one step back596 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 597why, one step back597 cookies: CookieTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 598why, one step back598 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 599why, one step back599 auth: AuthTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 600why, one step back600 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 601–603why, one step back601 cert: CertTypes = None,602 verify: VerifyTypes = None,603 timeout: TimeoutTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 604–608why, one step back604 ) -> SyncResponse:605 return self.request(606 "OPTIONS",607 url,608 headers=headers,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 609why, one step back609 cookies=cookies,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 610why, one step back610 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 611why, one step back611 auth=auth,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 612why, one step back612 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 613–614why, one step back613 verify=verify,614 cert=cert,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 615–621why, one step back615 timeout=timeout,616 )617618 def head(619 self,620 url: URLTypes,621 *,query_params -> paramsTom Christiebefore adoptionbb70377
line 622why, one step back622 params: QueryParamTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 623why, one step back623 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 624why, one step back624 cookies: CookieTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 625why, one step back625 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 626why, one step back626 auth: AuthTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 627why, one step back627 allow_redirects: bool = False, # Note: Differs to usual default.Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 628–630why, one step back628 cert: CertTypes = None,629 verify: VerifyTypes = None,630 timeout: TimeoutTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 631–635why, one step back631 ) -> SyncResponse:632 return self.request(633 "HEAD",634 url,635 headers=headers,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 636why, one step back636 cookies=cookies,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 637why, one step back637 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 638why, one step back638 auth=auth,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 639why, one step back639 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 640–641why, one step back640 verify=verify,641 cert=cert,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 642–649why, one step back642 timeout=timeout,643 )644645 def post(646 self,647 url: URLTypes,648 *,649 data: RequestData = b"",Add json interfacesTom Christiebefore adoption5a63d31
line 650why, one step back650 json: typing.Any = None,query_params -> paramsTom Christiebefore adoptionbb70377
line 651why, one step back651 params: QueryParamTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 652why, one step back652 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 653why, one step back653 cookies: CookieTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 654why, one step back654 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 655why, one step back655 auth: AuthTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 656why, one step back656 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 657–659why, one step back657 cert: CertTypes = None,658 verify: VerifyTypes = None,659 timeout: TimeoutTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 660–664why, one step back660 ) -> SyncResponse:661 return self.request(662 "POST",663 url,664 data=data,Add json interfacesTom Christiebefore adoption5a63d31
line 665why, one step back665 json=json,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 666why, one step back666 headers=headers,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 667why, one step back667 cookies=cookies,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 668why, one step back668 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 669why, one step back669 auth=auth,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 670why, one step back670 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 671–672why, one step back671 verify=verify,672 cert=cert,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 673–680why, one step back673 timeout=timeout,674 )675676 def put(677 self,678 url: URLTypes,679 *,680 data: RequestData = b"",Add json interfacesTom Christiebefore adoption5a63d31
line 681why, one step back681 json: typing.Any = None,query_params -> paramsTom Christiebefore adoptionbb70377
line 682why, one step back682 params: QueryParamTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 683why, one step back683 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 684why, one step back684 cookies: CookieTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 685why, one step back685 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 686why, one step back686 auth: AuthTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 687why, one step back687 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 688–690why, one step back688 cert: CertTypes = None,689 verify: VerifyTypes = None,690 timeout: TimeoutTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 691–695why, one step back691 ) -> SyncResponse:692 return self.request(693 "PUT",694 url,695 data=data,Add json interfacesTom Christiebefore adoption5a63d31
line 696why, one step back696 json=json,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 697why, one step back697 headers=headers,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 698why, one step back698 cookies=cookies,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 699why, one step back699 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 700why, one step back700 auth=auth,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 701why, one step back701 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 702–703why, one step back702 verify=verify,703 cert=cert,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 704–711why, one step back704 timeout=timeout,705 )706707 def patch(708 self,709 url: URLTypes,710 *,711 data: RequestData = b"",Add json interfacesTom Christiebefore adoption5a63d31
line 712why, one step back712 json: typing.Any = None,query_params -> paramsTom Christiebefore adoptionbb70377
line 713why, one step back713 params: QueryParamTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 714why, one step back714 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 715why, one step back715 cookies: CookieTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 716why, one step back716 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 717why, one step back717 auth: AuthTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 718why, one step back718 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 719–721why, one step back719 cert: CertTypes = None,720 verify: VerifyTypes = None,721 timeout: TimeoutTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 722–726why, one step back722 ) -> SyncResponse:723 return self.request(724 "PATCH",725 url,726 data=data,Add json interfacesTom Christiebefore adoption5a63d31
line 727why, one step back727 json=json,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 728why, one step back728 headers=headers,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 729why, one step back729 cookies=cookies,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 730why, one step back730 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 731why, one step back731 auth=auth,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 732why, one step back732 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 733–734why, one step back733 verify=verify,734 cert=cert,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 735–742why, one step back735 timeout=timeout,736 )737738 def delete(739 self,740 url: URLTypes,741 *,742 data: RequestData = b"",Add json interfacesTom Christiebefore adoption5a63d31
line 743why, one step back743 json: typing.Any = None,query_params -> paramsTom Christiebefore adoptionbb70377
line 744why, one step back744 params: QueryParamTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 745why, one step back745 headers: HeaderTypes = None,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 746why, one step back746 cookies: CookieTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 747why, one step back747 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 748why, one step back748 auth: AuthTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 749why, one step back749 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 750–752why, one step back750 cert: CertTypes = None,751 verify: VerifyTypes = None,752 timeout: TimeoutTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 753–757why, one step back753 ) -> SyncResponse:754 return self.request(755 "DELETE",756 url,757 data=data,Add json interfacesTom Christiebefore adoption5a63d31
line 758why, one step back758 json=json,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 759why, one step back759 headers=headers,Cookie support (#73)Tom Christiebefore adoptionfeae0a8
line 760why, one step back760 cookies=cookies,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 761why, one step back761 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 762why, one step back762 auth=auth,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 763why, one step back763 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 764–765why, one step back764 verify=verify,765 cert=cert,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 766–776why, one step back766 timeout=timeout,767 )768769 def prepare_request(self, request: Request) -> None:770 self._client.prepare_request(request)771772 def send(773 self,774 request: Request,775 *,776 stream: bool = False,Auth (#65)Tom Christiebefore adoption5afa7dd
line 777why, one step back777 auth: AuthTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 778why, one step back778 allow_redirects: bool = True,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 779–781why, one step back779 verify: VerifyTypes = None,780 cert: CertTypes = None,781 timeout: TimeoutTypes = None,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 782–786why, one step back782 ) -> SyncResponse:783 response = self._loop.run_until_complete(784 self._client.send(785 request,786 stream=stream,Auth (#65)Tom Christiebefore adoption5afa7dd
line 787why, one step back787 auth=auth,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
line 788why, one step back788 allow_redirects=allow_redirects,Work on bringing API into parity with `requests`. (#76)Tom Christiebefore adoption9574041
lines 789–790why, one step back789 verify=verify,790 cert=cert,Merge pull request #58 from encode/sync-by-defaultTom Christiebefore adoptionb6c27f0
lines 791–808why, one step back791 timeout=timeout,792 )793 )794 return SyncResponse(response, self._loop)795796 def close(self) -> None:797 self._loop.run_until_complete(self._client.close())798799 def __enter__(self) -> "Client":800 return self801802 def __exit__(803 self,804 exc_type: typing.Type[BaseException] = None,805 exc_value: BaseException = None,806 traceback: TracebackType = None,807 ) -> None:808 self.close()