xL i~ddlmZddlZddlZddlZddlZddlZddlZddlm Z m Z ddl m Z ddl m Z ddlmZmZmZddlmZmZmZmZmZmZdd lmZdd lmZmZmZmZdd l m!Z!m"Z"m#Z#m$Z$dd l%m&Z&dd l'm(Z(m)Z)ddl*m+Z+m,Z,ddl-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:ddl;mm?Z?m@Z@ejrddlBZBgdZCejddZEejddZFd,dZGd-dZHd.dZIGddZJeJZKejdZMde ZNdjejDcgc] }|d k7s | c}ZQGd!d"ejZSGd#d$e9ZTGd%d&e.ZUejd'ejfZXGd(d)ZYGd*deYZZGd+deYZ[ycc}w)/) annotationsN)asynccontextmanagercontextmanager) TracebackType) __version__)Auth BasicAuth FunctionAuth)DEFAULT_LIMITSDEFAULT_MAX_REDIRECTSDEFAULT_TIMEOUT_CONFIGLimitsProxyTimeout)SUPPORTED_DECODERS) InvalidURLRemoteProtocolErrorTooManyRedirectsrequest_context)CookiesHeadersRequestResponse)codes)AsyncBaseTransport BaseTransport)AsyncHTTPTransport HTTPTransport) AsyncByteStream AuthTypes CertTypes CookieTypes HeaderTypes ProxyTypesQueryParamTypesRequestContent RequestDataRequestExtensions RequestFilesSyncByteStream TimeoutTypes)URL QueryParams) URLPatternget_environment_proxies)USE_CLIENT_DEFAULT AsyncClientClientTr3)boundUr2c|j|jk7ry|jdk(xr/t|dk(xr|jdk(xrt|dk(S)zA Return 'True' if 'location' is a HTTPS upgrade of 'url' FhttpPhttps)hostscheme_port_or_default)urllocations S/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/httpx/_client.py_is_https_redirectrB>sa xx8==  f . S !R ' . OOw & . X &# - cn|j |jSdddj|jS)Nr9r;)r8r:)portgetr=r?s rAr>r>Ms/ xxxx % ) )#** 55rCc|j|jk(xr2|j|jk(xrt|t|k(S)z@ Return 'True' if the given URLs share the same origin. )r=r<r>)r?others rA _same_originrJSsF ell" = HH " = S !%5e%< <rCceZdZdZy)UseClientDefaulta< For some parameters such as `auth=...` and `timeout=...` we need to be able to indicate the default "unset" state, in a way that is distinctly different to using `None`. The default "unset" state indicates that whatever default is set on the client should be used. This is different to setting `None`, which explicitly disables the parameter, possibly overriding a client default. For example we use `timeout=USE_CLIENT_DEFAULT` in the `request()` signature. Omitting the `timeout` parameter will send a request using whatever default timeout has been configured on the client. Including `timeout=None` will ensure no timeout is used. Note that user code shouldn't need to use the `USE_CLIENT_DEFAULT` constant, but it is used internally when a parameter is not included. N)__name__ __module__ __qualname____doc__rCrArLrL^srCrLhttpxz python-httpx/z, identityceZdZdZdZdZy) ClientStaterN)rMrNrOUNOPENEDOPENEDCLOSEDrQrCrArUrU}sHFFrCrUc8eZdZdZ ddZddZddZy) BoundSyncStreamz A byte stream that is bound to a given response instance, and that ensures the `response.elapsed` is set once the response is closed. c.||_||_||_yN_stream _response_startselfstreamresponsestarts rA__init__zBoundSyncStream.__init__ ! rCc#6K|jD]}|ywr^r`rdchunks rA__iter__zBoundSyncStream.__iter__s\\ EK sctj|jz }tj||j _|jjyN)seconds) time perf_counterrbdatetime timedeltaraelapsedr`closerdrvs rArwzBoundSyncStream.closes@##% 3!)!3!3G!D rCN)rer+rfrrgfloatreturnNone)rzztyping.Iterator[bytes]rzr{)rMrNrOrPrhrnrwrQrCrAr\r\s6 $08AF rCr\c8eZdZdZ ddZddZddZy) BoundAsyncStreamz An async byte stream that is bound to a given response instance, and that ensures the `response.elapsed` is set once the response is closed. c.||_||_||_yr^r_rcs rArhzBoundAsyncStream.__init__rirCcHK|j23d{}|7 6ywr^rkrls rA __aiter__zBoundAsyncStream.__aiter__s&<<  %K dZ d< d?dZd@d Zef dAd!ZdBd"ZdCd#ZdDd$ZdEd%Z dFd&ZdGd'Z y)H BaseClientNFTutf-8 authparamsheaderscookiestimeoutfollow_redirects max_redirects event_hooksbase_url trust_envdefault_encodingc |in|}|jt| |_|j||_t ||_t||_t||_ t||_ ||_ ||_t|j!dgt|j!dgd|_| |_| |_t(j*|_yNrequestrf)rrf)_enforce_trailing_slashr- _base_url _build_auth_authr._paramsrrr_cookiesr_timeoutrrlistrF _event_hooks _trust_env_default_encodingrUrX_state) rdrrrrrrrrrrrs rArhzBaseClient.__init__s(/b[ 55c(mD%%d+ "6* w' ( ( 0*KOOIr:;[__Z<= $!1!** rCc<|jtjk(S)z2 Check if the client being closed )rrUrZrds rA is_closedzBaseClient.is_closeds {{k0000rCc|jSr^)rrs rArzBaseClient.trust_envs rCcz|jjdr|S|j|jdzS)N/raw_path)rendswith copy_withrdr?s rArz"BaseClient._enforce_trailing_slashs3 <<  &J}}cllT&9}::rCc|>|r:tjDcic]\}}||dn t|c}}SiSt|tt fr t|n|}d|iScc}}w)NrGzall://)r0itemsr isinstancestrr-)rdproxyallow_env_proxieskeyr?s rA_get_proxy_mapzBaseClient._get_proxy_mapsx = %<$=$C$C$E S%C.@I(253*(EEe$5Ee$ $sA)c|jSr^)rrs rArzBaseClient.timeouts }}rCc$t||_yr^)rr)rdrs rArzBaseClient.timeout( rCc|jSr^)rrs rArzBaseClient.event_hookss   rCc|t|jdgt|jdgd|_yr)rrFr)rdrs rArzBaseClient.event_hooks s4KOOIr:;[__Z<= rCc|jS)z Authentication class used when none is passed at the request-level. See also [Authentication][0]. [0]: /quickstart/#authentication )rrs rArzBaseClient.authszzrCc0|j||_yr^)rrrdrs rArzBaseClient.auths%%d+ rCc|jS)zK Base URL to use when sending requests with relative URLs. )rrs rArzBaseClient.base_urls ~~rCcB|jt||_yr^)rr-rrs rArzBaseClient.base_url&s55c#h?rCc|jS)z@ HTTP headers to include when sending requests. )_headersrs rArzBaseClient.headers* }}rCctdtjddtjdd}|j |||_y)Ns*/*asciis keep-alive)sAcceptsAccept-Encodings Connections User-Agent)rACCEPT_ENCODINGencode USER_AGENTupdater)rdrclient_headerss rArzBaseClient.headers1sJ !$3$:$:7$C,)009    g&& rCc|jS)zA Cookie values to include when sending requests. )rrs rArzBaseClient.cookies>rrCc$t||_yr^)rr)rdrs rArzBaseClient.cookiesErrCc|jS)zO Query parameters to include in the URL when sending requests. )rrs rArzBaseClient.paramsIs ||rCc$t||_yr^)r.r)rdrs rArzBaseClient.paramsPs"6* rC) contentdatafilesjsonrrrr extensionsc P|j|}|j|}|j| } |j|}| in| } d| vrDt | t r |j n t| } tdi| d| ji} t||||||||| |  S)aR Build and return a request instance. * The `params`, `headers` and `cookies` arguments are merged with any values set on the client. * The `url` argument is merged with any `base_url` set on the client. See also: [Request instances][0] [0]: /advanced/clients/#request-instances r)rrrrrrrrrQ) _merge_url_merge_headers_merge_cookies_merge_queryparamsrrLrrdictas_dictr) rdmethodr?rrrrrrrrrs rA build_requestzBaseClient.build_requestTs4ooc"%%g.%%g.((0%-R: J &g'78 W%  F FGOO4EFJ  !  rCct|}|jrN|jj|jj dz}|jj |S|S)z Merge a URL argument together with any 'base_url' on the client, to create the URL used for the outgoing request. rr)r-is_relative_urlrrlstripr)rdr? merge_urlmerge_raw_paths rArzBaseClient._merge_urls\ H  $ $"]]33i6H6H6O6OPT6UUN==**N*C CrCcr|s |jr(t|j}|j||S|S)z Merge a cookies argument together with any cookies on the client, to create the cookies used for the outgoing request. )rrr)rdrmerged_cookiess rArzBaseClient._merge_cookiess4 dll$T\\2N  ! !' *! !rCcRt|j}|j||S)z Merge a headers argument together with any headers on the client, to create the headers used for the outgoing request. )rrr)rdrmerged_headerss rArzBaseClient._merge_headerss& !.g&rCcn|s |jr&t|j}|j|S|S)z Merge a queryparams argument together with any queryparams on the client, to create the queryparams used for the outgoing request. )rr.merge)rdrmerged_queryparamss rArzBaseClient._merge_queryparamss2 T[[!,T[[!9 %++F3 3 rCc|yt|trt|d|dSt|tr|St |r t |St d|)Nrrusernamepassword)funczInvalid "auth" argument: )rtupler r callabler TypeErrorrs rArzBaseClient._build_auths] < e $d1gQ@ @ d #K d^T* *7x@A ArCct|tr |jn|j|}||S|jj |jj }}|s|r t||StS)Nr) rrLrrr?rrr r )rdrrrrs rA_build_request_authzBaseClient._build_request_authsk %T+;&&w7$,,'))   rCc|j}|jtjk(r|dk7rd}|jtjk(r|dk7rd}|jtj k(r|dk(rd}|S)z When being redirected we may want to change the method of the request based on certain specs or browser behavior. HEADGETPOST)r status_coder SEE_OTHERFOUNDMOVED_PERMANENTLY)rdrrfrs rArzBaseClient._redirect_methodst    5?? 2v7GF   5;; .6V3CF   5#:#: :v?OF rCc|jd} t|}|jr2|j s&|j |jj }|jr|jj|}|jjr2|js&|j |jj}|S#t$r}td|d|dd}~wwxYw)z< Return the URL for the redirect to follow. Locationz Invalid URL in location header: .rN)r<)fragment) rr-rrr=r<rr?rjoinr)rdrrfr@r?excs rArzBaseClient._redirect_urls##J/ h-C ::chh--W[[%5%5-6C   ++""3'C ;;   --)=)=->C ' %23%q97  s C C+C&&C+c|t|j}t||jsFt |j|s|j dd|j jd|d<||jk7r)|dk(r$|j dd|j dd|j dd|S) zR Return the headers that should be used for the redirect request. AuthorizationNrHostrzContent-LengthzTransfer-EncodingCookie) rrrJr?rBpopnetlocdecoder)rdrr?rrs rArzBaseClient._redirect_headers"s'//*C-%gkk37 OT2"jj//8GFO W^^ #% KK($ / KK+T 2  Hd#rCcD||jk7r|dk(ry|jS)zO Return the body that should be used for the redirect request. rN)rre)rdrrs rArzBaseClient._redirect_stream=s# W^^ #%~~rCcd|jvrht|jtr |jnt |j}t di|jd|j i|_yy)NrrQ)rrrrLrrr)rdrrs rA _set_timeoutzBaseClient._set_timeoutHsd G.. .dll,<= T\\*  "&!V(:(:!VGOODU!VG  /rC)rAuthTypes | NonerQueryParamTypes | NonerHeaderTypes | NonerCookieTypes | Nonerr,rboolrintr+None | typing.Mapping[str, list[EventHook]]r URL | strrrr#str | typing.Callable[[bytes], str]rzr{)rzr)r?r-rzr-)rProxyTypes | Nonerrrzzdict[str, Proxy | None])rzr)rr,rzr{)rzdict[str, list[EventHook]])rrrzr{)rz Auth | None)rr!rzr{)rzr-)r?rrzr{)rzr)rr$rzr{)rzr)rr#rzr{)rzr.)rr&rzr{)rrr?rrRequestContent | NonerRequestData | NonerRequestFiles | Nonertyping.Any | NonerrrrrrrTimeoutTypes | UseClientDefaultrRequestExtensions | Nonerzr)r?rrzr-r^)rrrzr)rrrzr)rrrzr)rrrzr)rrr#AuthTypes | UseClientDefault | Nonerzr )rrrfrrzr)rrrfrrzr)rrrfrrzr-)rrr?r-rrrzr)rrrrrzz'SyncByteStream | AsyncByteStream | None)rrrzr{)!rMrNrOrr rhpropertyrrrrrsetterrrrrrrr1rrrrrrrrrrrrrrQrCrArrsL"&)-&*&* 6!&2EI @G + +' + $ + $ + + + +C + + +> +  +D11 ; %& %;? %  % ^^))!!   [[,, __@@  ^^ ' '  ^^))  ]]++*.#'%)"&)-&*&*3E/31 1 1 ' 1 ! 1 #1  1 '1 $1 $1 11 -1  1 f, 04 ,    B5G2  $ &.:6  (+  0 WrCrcBeZdZdZdddddddddddedeeddddd dfdZdddddedf d d Zdddddef d!d Z d"d Z ddddddde e e dd d#d Z e ddddddde e e dd d$dZde e d d%dZ d&dZ d'dZd(dZddde e e dd d)dZddde e e dd d*dZddde e e dd d*dZddddddde e e dd d+dZddddddde e e dd d+dZddddddde e e dd d+dZddde e e dd d*dZd,dZd-dZ d. d/dZxZS)0r3av An HTTP client, with connection pooling, HTTP/2, redirects, cookie persistence, etc. It can be shared between threads. Usage: ```python >>> client = httpx.Client() >>> response = client.get('https://example.org') ``` **Parameters:** * **auth** - *(optional)* An authentication class to use when sending requests. * **params** - *(optional)* Query parameters to include in request URLs, as a string, dictionary, or sequence of two-tuples. * **headers** - *(optional)* Dictionary of HTTP headers to include when sending requests. * **cookies** - *(optional)* Dictionary of Cookie items to include when sending requests. * **verify** - *(optional)* Either `True` to use an SSL context with the default CA bundle, `False` to disable verification, or an instance of `ssl.SSLContext` to use a custom context. * **http2** - *(optional)* A boolean indicating if HTTP/2 support should be enabled. Defaults to `False`. * **proxy** - *(optional)* A proxy URL where all the traffic should be routed. * **timeout** - *(optional)* The timeout configuration to use when sending requests. * **limits** - *(optional)* The limits configuration to use. * **max_redirects** - *(optional)* The maximum number of redirect responses that should be followed. * **base_url** - *(optional)* A URL to use as the base when building request URLs. * **transport** - *(optional)* A transport class to use for sending requests over the network. * **trust_env** - *(optional)* Enables or disables usage of environment variables for configuration. * **default_encoding** - *(optional)* The default encoding to use for decoding response text, if no charset information is included in a response Content-Type header. Set to a callable for automatic character set detection. Default: "utf-8". NTFrr)rrrrverifycertrhttp1http2rmountsrrlimitsrrr transportrct|||||| | ||||| | r ddl}|xr|du}|j | |}|j ||||| |||_|jD cic]+\}} t|| dn|j| ||||| |-c} }|_ | F|jj| jDcic]\}}t||c}}tt|jj|_ y#t$r tddwxYwcc} }wcc}}wNrrzuUsing http2=True, but the 'h2' package is not installed. Make sure to install httpx using `pip install httpx[http2]`.)r'r(rr)r*r,r-r'r(rr)r*r,superrhh2 ImportErrorr_init_transport _transportrr/_init_proxy_transport_mountsrrsorted)rdrrrrr'r(rr)r*rr+rrr,rrrr-rr3r proxy_mapr __class__s rArhzClient.__init__s. -'#-    &;)t*;''/@A ../ *(oo/ @ U sO}"++#,  @     LL  BH,,.QYC)+Q F4<<#5#5#789 K !S $ @ RD -0D9D? D6c,||St||||||SNr0rrdr'r(rr)r*r,r-s rAr5zClient._init_transports/      rCc &t|||||||SN)r'r(rr)r*r,rr?rdrr'r(rr)r*r,s rAr7zClient._init_proxy_transports&  rCc|jjD]*\}}|j|s||jcS|cS|jSz Returns the transport instance that should be used for a given URL. This will either be the standard connection pool, or a proxy. r8rmatchesr6rdr?patternr-s rA_transport_for_urlzClient._transport_for_urlS #',,"4"4"6 K GYs#*3*;tJJ KrC rrrrrrrrrrrc | d}tj|td|j||||||||| | |  }|j || | S)a Build and send a request. Equivalent to: ```python request = client.build_request(...) response = client.send(request, ...) ``` See `Client.build_request()`, `Client.send()` and [Merging of configuration][0] for how the various parameters are merged with client-level configuration. [0]: /advanced/clients/#merging-of-configuration Setting per-request cookies=<...> is being deprecated, because the expected behaviour on cookie persistence is ambiguous. Set cookies directly on the client instance instead.rV stacklevel rr?rrrrrrrrrrrwarningswarnDeprecationWarningrsendrdrr?rrrrrrrrrrrmessagers rArzClient.requestswB  C  MM'#5! D$$!%  yyt>NyOOrCc #K|j||||||||| | |  }|j|| | d} ||jy#|jwxYwwa  Alternative to `httpx.request()` that streams the response body instead of loading it into memory at once. **Parameters**: See `httpx.request`. See also: [Streaming Responses][0] [0]: /quickstart#streaming-responses rQT)rrrreN)rrWrwrdrr?rrrrrrrrrrrrrfs rArez Client.stream;s}8$$!%  99-    N NN HNN s2AA A AArerrc|jtjk(r tdtj|_t |t r |jn|}|j||j||}|j|||g} |s|j|S#t$r}|j|d}~wwxYw)a Send a request. The request is sent as-is, unmodified. Typically you'll want to build one with `Client.build_request()` so that any client-level configuration is merged into the request, but passing an explicit `httpx.Request()` is supported as well. See also: [Request instances][0] [0]: /advanced/clients/#request-instances 5Cannot send a request, as the client has been closed.rrhistoryN)rrUrZ RuntimeErrorrYrrLrrr_send_handling_authread BaseExceptionrwrdrrerrrfrs rArWz Client.sendos* ;;+,, ,VW W!(( *,<=  ! !!  '"''6++ - ,    O  NN I sB)) C 2CC c|j|} t|} |j|||} |j|}t ||_|j|}|j|[#t$r|cY|j SwxYw#t$r}|j |d}~wwxYw#|j wxYwN)rra) sync_auth_flownext_send_handling_redirectsrW StopIterationrwrrardappendre rdrrrra auth_flowrf next_requestrs rArczClient._send_handling_auths''0  9oG88%5#9 ('0~~h'? (,G}H$MMO*GNN8,)(' OO (%NN$I OO sL B>A:3B9B>: BBBB B;$B66B;;B>>Cc t||jkDr td||jdD] }|| |j |} |jdD] }|| t ||_|js|S|j||}||gz}|r|jn ||_ |S #t$r}|j|d}~wwxYwNz#Exceeded maximum allowed redirects.rrrf) lenrrr_send_single_requestrrahas_redirect_locationrrdrprerwrdrrrahookrfrs rArkzClient._send_handling_redirectss 7|d000&97)))4 W  009H  --j9#DN##'= 55#O66wI!XJ.#MMO,3H)#O$-6!    s9C3C C%C  C%c|j|j}tj}t |j t s tdt|5|j|}dddt j t sJ||_ t|j |||_|jj||j|_t j#d|j$|j|j&|j(|j*|S#1swYxYw)L Sends a single request, without handling any redirections. z?Attempted to send an async request with a sync Client instance.rNrfrgHTTP Request: %s %s "%s %d %s")rJr?rrrsrrer+rbrhandle_requestrr\rextract_cookiesrrloggerinfor http_versionr reason_phraserdrr-rgrfs rArtzClient._send_single_requests ++GKK8 !!#'...9Q W - 9 //8H 9(//>:::") OOhe  $$X.$($:$:! , NN KK  ! !   " "  + 9 9s !D55D>rrrrrrrc 6|jd|||||||| S)U Send a `GET` request. **Parameters**: See `httpx.request`. rrr rdr?rrrrrrrs rArFz Client.get s5"||  -!  rCc 6|jd|||||||| S)Z Send an `OPTIONS` request. **Parameters**: See `httpx.request`. OPTIONSrrrs rAoptionszClient.options)s5"||  -!  rCc 6|jd|||||||| S)V Send a `HEAD` request. **Parameters**: See `httpx.request`. rrrrs rAheadz Client.headFs5"||  -!  rCc >|jd||||||||| | | |  S)V Send a `POST` request. **Parameters**: See `httpx.request`. rrLr rdr?rrrrrrrrrrrs rApostz Client.postcsA*||  -!  rCc >|jd||||||||| | | |  S)U Send a `PUT` request. **Parameters**: See `httpx.request`. PUTrLrrs rAputz Client.putsA*||  -!  rCc >|jd||||||||| | | |  S)W Send a `PATCH` request. **Parameters**: See `httpx.request`. PATCHrLrrs rApatchz Client.patchsA*||  -!  rCc 6|jd|||||||| S)X Send a `DELETE` request. **Parameters**: See `httpx.request`. DELETErrrs rAdeletez Client.deletes5"||  -!  rCc|jtjk7rbtj|_|jj |j j D]}||j yyz. Close transport and proxies. N)rrUrZr6rwr8values)rdr-s rArwz Client.closesd ;;+,, ,%,,DK OO ! ! #!\\002 & (OO% & -rCcv|jtjk7r:tjdtjdi|j}t |tj|_|j j|jjD]}||j|SNz-Cannot open a client instance more than once.z9Cannot reopen a client instance, once it has been closed.) rrUrXrYrZrbr6 __enter__r8r)rdmsgr-s rArzClient.__enter__s ;;+.. .""$S""O kk C s# #!((  !!#,,. &I$##% & rCctj|_|jj ||||j j D]}||j |||yr^)rUrZrr6__exit__r8r)rdexc_type exc_value tracebackr-s rArzClient.__exit__ s] "((    9i@,,. CI$""8Y B CrC)(rrrrrrrrr'ssl.SSLContext | str | boolr(CertTypes | Nonerrr)rr*rrrr+z0None | typing.Mapping[str, BaseTransport | None]rr,rrr,rrrrrrrr-BaseTransport | Nonerrrzr{)r'rr(rrrr)rr*rr,rr-rrzr)rrr'rr(rrrr)rr*rr,rrzr)r?r-rzrrrr?rrrrrrrrr rrrrrrrr#rbool | UseClientDefaultrr!rr"rzr)rrr?rrrrrrrrr rrrrrrrr#rrrr!rr"rzztyping.Iterator[Response] rrrerrr#rrrzr rrrr rrralist[Response]rzrrrrrrarrzrrrrzrr?rrrrrrrrr#rrrr!rr"rzrr?rrrrrrrrAuthTypes | UseClientDefaultrrrr!rr"rzrr?rrrrrrrrr rrrrrrrrrrrr!rr"rzrr|)rdr4rzr4NNNrztype[BaseException] | NonerzBaseException | NonerzTracebackType | Nonerzr{)rMrNrOrPrr r rhr5r7rJr1rrrerWrcrkrtrFrrrrrrrwrr __classcell__r;s@rAr3r3Rs?*^"&)-&*&*.2!%#'EI 6!&'2EI *.@G+M:M:' M: $ M: $ M:,M:M:M:M:M:!M:CM:M:M: !M:"#M:$C%M:&'M:(()M:*>+M:, -M:b/3!%'*. +         (   2/3!%'  ,           (  *.#'%)"&)-&*&*4F4F3E/36P6P6P ' 6P ! 6P#6P 6P'6P$6P$6P26P26P16P-6P !6Pp *.#'%)"&)-&*&*4F4F3E/3111 ' 1 ! 1#1 1'1$1$1212111-1 #!11n4F4F 11 1 2 1 2 1 1f        D### #  #J!N*.&*&*4F4F3E/3  '  $  $  2 2 1 -   B*.&*&*-?4F3E/3  '  $  $  + 2 1 -   B*.&*&*-?4F3E/3  '  $  $  + 2 1 -   B*.#'%)"&)-&*&*-?4F3E/3# # ' # ! # # #  # '# $# $# +# 2# 1# -#  # R*.#'%)"&)-&*&*-?4F3E/3# # ' # ! # # #  # '# $# $# +# 2# 1# -#  # R*.#'%)"&)-&*&*-?4F3E/3# # ' # ! # # #  # '# $# $# +# 2# 1# -#  # R*.&*&*-?4F3E/3  '  $  $  + 2 1 -   : &(04*.*. C, C( C( C  CrCcBeZdZdZddddddddddedeedddddd dfdZdddddedf d d Zdddddef d!d Z d"d Z ddddddde e e dd d#d Z e ddddddde e e dd d$dZde e d d%dZ d&dZ d'dZd(dZddde e e dd d)dZddde e e dd d*dZddde e e dd d*dZddddddde e e dd d+dZddddddde e e dd d+dZddddddde e e dd d+dZddde e e dd d*dZd,dZd-dZ d. d/dZxZS)0r2a An asynchronous HTTP client, with connection pooling, HTTP/2, redirects, cookie persistence, etc. It can be shared between tasks. Usage: ```python >>> async with httpx.AsyncClient() as client: >>> response = await client.get('https://example.org') ``` **Parameters:** * **auth** - *(optional)* An authentication class to use when sending requests. * **params** - *(optional)* Query parameters to include in request URLs, as a string, dictionary, or sequence of two-tuples. * **headers** - *(optional)* Dictionary of HTTP headers to include when sending requests. * **cookies** - *(optional)* Dictionary of Cookie items to include when sending requests. * **verify** - *(optional)* Either `True` to use an SSL context with the default CA bundle, `False` to disable verification, or an instance of `ssl.SSLContext` to use a custom context. * **http2** - *(optional)* A boolean indicating if HTTP/2 support should be enabled. Defaults to `False`. * **proxy** - *(optional)* A proxy URL where all the traffic should be routed. * **timeout** - *(optional)* The timeout configuration to use when sending requests. * **limits** - *(optional)* The limits configuration to use. * **max_redirects** - *(optional)* The maximum number of redirect responses that should be followed. * **base_url** - *(optional)* A URL to use as the base when building request URLs. * **transport** - *(optional)* A transport class to use for sending requests over the network. * **trust_env** - *(optional)* Enables or disables usage of environment variables for configuration. * **default_encoding** - *(optional)* The default encoding to use for decoding response text, if no charset information is included in a response Content-Type header. Set to a callable for automatic character set detection. Default: "utf-8". NTFrr)rrrrr'r(r)r*rr+rrr,rrrr-rrct|||||| | ||||| |r ddl}|xr|du}|j | |}|j |||||| ||_|jD cic]+\}} t|| dn|j| |||||| -c} }|_ | F|jj| jDcic]\}}t||c}}tt|jj|_ y#t$r tddwxYwcc} }wcc}}wr/r1)rdrrrrr'r(r)r*rr+rrr,rrrr-rrr3rr:rr;s rArhzAsyncClient.__init__Is. -'#-    &;)t*;''/@A ../ ,(oo/ E U sO}"++#,  E     LL  BH,,.QYC)+Q F4<<#5#5#789 K !S & E Rr<c,||St||||||Sr>rr@s rAr5zAsyncClient._init_transports/   !   rCc &t|||||||SrBrrCs rAr7z!AsyncClient._init_proxy_transports&"  rCc|jjD]*\}}|j|s||jcS|cS|jSrErFrHs rArJzAsyncClient._transport_for_urlrKrCrLc K| d}tj|td|j||||||||| | |  }|j || | d{S7w)a Build and send a request. Equivalent to: ```python request = client.build_request(...) response = await client.send(request, ...) ``` See `AsyncClient.build_request()`, `AsyncClient.send()` and [Merging of configuration][0] for how the various parameters are merged with client-level configuration. [0]: /advanced/clients/#merging-of-configuration NrNrVrOrQrRrSrXs rArzAsyncClient.requestsD  C  MM'#5! D$$!%  YYwTDTYUUUUsAAAAc K|j||||||||| | |  }|j|| | dd{} ||jd{y7#7#|jd{7wxYwwr[)rrWrr\s rArezAsyncClient.streams8$$!%  - #    $N//# # #  $(//# # #sD5A=AA=AA=AA=A=A:3A64A::A=r]cK|jtjk(r tdtj|_t |t r |jn|}|j||j||}|j|||gd{} |s|jd{|S7!7#t$r }|jd{7|d}~wwxYww)a Send a request. The request is sent as-is, unmodified. Typically you'll want to build one with `AsyncClient.build_request()` so that any client-level configuration is merged into the request, but passing an explicit `httpx.Request()` is supported as well. See also: [Request instances][0] [0]: /advanced/clients/#request-instances r_r`N)rrUrZrbrYrrLrrrrcareadrerrfs rArWzAsyncClient.send:s* ;;+,, ,VW W!(( *,<=  ! !!  '"''611 - 2    nn&&&O ' //# # #I sTBC+B;C+B?4B=5B?:C+=B?? C(C#CC##C((C+c>K|j|} |jd{} |j|||d{} |j|d{}t ||_|jd{|}|j|s7x7]7D#t$r|cY|j d{7SwxYw7H#t$r }|j d{7|d}~wwxYw#|j d{7wxYwwrh) async_auth_flow __anext__rkasendStopAsyncIterationrrrarrmrerns rArczAsyncClient._send_handling_authms((1  %%//11G!%!>!>%5#"?" (-6__X-F'F (,G}H$"..****GNN8,2(G-('""$ $ $(+%"//+++I""$ $ $sDC?B!C?B#C? B' B%!B'%#CC C C?#C?%B'' C2C3DC D CC C<C7/C20C77C<<C??DDDDc:K t||jkDr td||jdD]}||d{|j |d{} |jdD]}||d{t ||_|js|S|j||}||gz}|r|jd{n ||_ |S 777f7#t$r }|jd{7|d}~wwxYwwrr) rsrrrrtrrarurrrprerrvs rArkz$AsyncClient._send_handling_redirectss8 7|d000&97)))4 $7m## $"66w??H  --j9)Dx.(()$(= 55#O66wI!XJ.#"..***,3H)#O+/$?)+ ! oo'''  sADC'D!C)"D'C/C+#C/(D)-C/C- C/$D)D+C/-C// D8D D DDDcK|j|j}tj}t |j t s tdt|5|j|d{}dddt j t sJ||_ t|j |||_|jj||j|_t j#d|j$|j|j&|j(|j*|S7#1swYxYww)ryz?Attempted to send an sync request with an AsyncClient instance.rNrzr{)rJr?rrrsrrer rbrhandle_async_requestrr~rr}rrr~rrrrrrs rArtz AsyncClient._send_single_requests++GKK8 !!#'../:Q W - E&;;GDDH E(//?;;;"* OOhe  $$X.$($:$:! , NN KK  ! !   " "  'E E Es1A!E #E8D?9E=CE ?EE E rc RK|jd|||||||| d{S7w)rrrNrrs rArFzAsyncClient.getsC"\\  -!"    '%'c RK|jd|||||||| d{S7w)rrrNrrs rArzAsyncClient.optionssC"\\  -!"    rc RK|jd|||||||| d{S7w)rrrNrrs rArzAsyncClient.headsC"\\  -!"    rc ZK|jd||||||||| | | |  d{S7w)rrrLNrrs rArzAsyncClient.post.sO*\\  -!"    "+)+c ZK|jd||||||||| | | |  d{S7w)rrrLNrrs rArzAsyncClient.putSsO*\\  -!"    rc ZK|jd||||||||| | | |  d{S7w)rrrLNrrs rArzAsyncClient.patchxsO*\\  -!"    rc RK|jd|||||||| d{S7w)rrrNrrs rArzAsyncClient.deletesC"\\  -!"    rc2K|jtjk7rrtj|_|jj d{|j j D]}||j d{yy7@7 wr)rrUrZr6rr8r)rdrs rArzAsyncClient.acloses~ ;;+,, ,%,,DK//((* * *,,. )$,,.(( ) - +)s*ABB#B7B B BBcK|jtjk7r:tjdtjdi|j}t |tj|_|j jd{|jjD]}||jd{|S7@7 wr) rrUrXrYrZrbr6 __aenter__r8r)rdrrs rArzAsyncClient.__aenter__s ;;+.. .""$S""O kk C s# #!(( oo((***\\((* )E &&((( ) +)s*B C C  #C1CC CCcKtj|_|jj |||d{|j j D] }||j |||d{"y7B7 wr^)rUrZrr6 __aexit__r8r)rdrrrrs rArzAsyncClient.__aexit__sx "(( oo'')YGGG\\((* FE ooh 9EEE F HFs'6A?A;#A?A?3A=4A?=A?)(rrrrrrrrr'rr(rr)rr*rrrr+z5None | typing.Mapping[str, AsyncBaseTransport | None]rr,rrr,rrrrrrrr-AsyncBaseTransport | Nonerrrrrzr{)r'rr(rrrr)rr*rr,rr-rrzr)rrr'rr(rrrr)rr*rr,rrzr)r?r-rzrr)rrr?rrrrrrrrr rrrrrrrr#rrrr!rr"rzztyping.AsyncIterator[Response]rrrrrrrr|)rdr6rzr6rr)rMrNrOrPrr r rhr5r7rJr1rrrerWrcrkrtrFrrrrrrrrrrrs@rAr2r2s?+`"&)-&*&*.2!%#'JN 6!&'2EI /3@G+M:M:' M: $ M: $ M:,M:M:M:M:!M:HM:M:M:M: !M:"C#M:$%M:&-'M:()M:*>+M:, -M:b/3!%'/3 +         -   2/3!%'  ,           (  *.#'%)"&)-&*&*4F4F3E/37V7V7V ' 7V ! 7V#7V 7V'7V$7V$7V27V27V17V-7V !7Vr *.#'%)"&)-&*&*4F4F3E/31$1$1$ ' 1$ ! 1$#1$ 1$'1$$1$$1$21$21$11$-1$ (!1$1$n4F4F 11 1 2 1 2 1 1f % % % %  %  %D$$$ $  $L L*.&*&*4F4F3E/3  '  $  $  2 2 1 -   B*.&*&*-?4F3E/3  '  $  $  + 2 1 -   B*.&*&*-?4F3E/3  '  $  $  + 2 1 -   B*.#'%)"&)-&*&*-?4F3E/3# # ' # ! # # #  # '# $# $# +# 2# 1# -#  # R*.#'%)"&)-&*&*-?4F3E/3# # ' # ! # # #  # '# $# $# +# 2# 1# -#  # R*.#'%)"&)-&*&*-?4F3E/3# # ' # ! # # #  # '# $# $# +# 2# 1# -#  # R*.&*&*-?4F3E/3  '  $  $  + 2 1 -   : )(04*.*. F, F( F( F  FrC)r?r-r@r-rzr)r?r-rzz int | None)r?r-rIr-rzr)\ __future__rrtenumloggingrrtypingrT contextlibrrtypesrrrr r r _configr r rrrr _decodersr _exceptionsrrrr_modelsrrrr _status_codesr_transports.baserr_transports.defaultrr_typesr r!r"r#r$r%r&r'r(r)r*r+r,_urlsr-r._utilsr/r0 TYPE_CHECKINGssl__all__TypeVarr4r6rBr>rJrLr1 getLoggerr~rrkeysrEnumrUr\r~CallableAny EventHookrr3r2)rs0rArs"  :$00* 98 ?B$7  9FNN3h'FNN3m, 6 (&'   7 #[M * ))+&++-CS 1BSC $)) n.$$. OOCO , SWSWl F CZF CRH F*H FE%Ds = F:F: