+
    '(j                       ^ RI Ht ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIt^ RIHtHtHt ^ RIHt ^ RIHtHtHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHtHtHtH t H!t!H"t"H#t#H$t$ ^ R
I%H&t& ^RI'H(t( ^RI)H*t*H+t+H,t,H-t- ^RI.H/t/H0t0H1t1 ^RI2H3t3 ^RI4H5t5H6t6H7t7 ^RI8H9t9H:t:H;t; ^RI<H=t=H>t> ^RI?H@t@HAtAHBtB ^RICHDtDHEtE ^RI2HFtFHGtGHHtHHItI ^RIJHKtKHLtLHMtMHNtNHOtO ]P                  R68  d   ]"! R]E]ER7      tQM
]"! R]ER7      tQ]'       dD   ^ RIRHStS  ! R R]!RR7      tT ! R R]]Q,          ]!RR7      tU ! R  R!]!RR7      tV ! R" R#]VRR7      tWM# ! R$ R%4      tX]X! 4       tS]Y]Z]Z3,          tT]!tU]!]!utVtW]R7,          t[]R8,          t\R& R' lt]R9R( R) llt^R9R* R+ llt_]R:,          t`] ! R, R-4      4       taR. R/ ltb ! R0 R1]]Q,          4      tc ! R2 R3]c]Q,          4      td ! R4 R5]c]Q,          4      teR# );    )annotationsN)AsyncGeneratorCallable	Generator)ThreadPoolExecutor)asynccontextmanagercontextmanagersuppress)	dataclass)	timedelta)BytesIO)TYPE_CHECKINGGenericLiteralOptional	TypedDictTypeVarUnioncast)urlparse)	AsyncCurl)
CurlFollowCurlHttpVersionCurlInfoCurlOpt)Curl	CurlErrorCurlMime)CurlCffiWarning)CookiesCookieTypes
CurlMorsel)RequestExceptionSessionClosed
code2error)HeadersHeaderTypes)BrowserTypeLiteralExtraFingerprintsExtraFpDict)
STREAM_ENDResponse)NOT_SETHttpVersionLiteral
NotSetTypeset_curl_options)AsyncWebSocketAsyncWebSocketContext	WebSocketWebSocketErrorWebSocketRetryStrategyR)bounddefault)r7   )Unpackc                  J    ] tR t^9t$ R]R&   R]R&   R]R&   R]R&   R]R&   RtR# )		ProxySpecstrallhttphttpswswss N__name__
__module____qualname____firstlineno____annotations____static_attributes__rB       O/home/ubuntu/cf-venv/lib/python3.14/site-packages/curl_cffi/requests/session.pyr;   r;   9   s    	
rJ   r;   F)totalc                  D   ] tR t^@t$ R]R&   R]R&   R]R&   R]R&   R	]R
&   R]R&   R	]R&   R]R&   R]R&   R]R&   R]R&   R]R&   R]R&   R]R&   R]R&   R	]R&   R	]R&   R	]R&   R]R &   R]R!&   R"]R#&   R]R$&   R%]R&&   R']R(&   R]R)&   R	]R*&   R+]R,&   R-]R.&   R]R/&   R]R0&   R1tR2# )3BaseSessionParamsOptional[HeaderTypes]headersOptional[CookieTypes]cookiesOptional[tuple[str, str]]authOptional[ProxySpec]proxiesOptional[str]proxy
proxy_authbase_urlOptional[dict]paramsboolverify!Union[float, tuple[float, float]]timeout	trust_envUnion[bool, CurlFollow, str]allow_redirectsintmax_redirectszUnion[int, RetryStrategy]retryOptional[BrowserTypeLiteral]impersonateja3akamaiperk/Optional[Union[ExtraFingerprints, ExtraFpDict]]extra_fpdefault_headers"Union[str, Callable[[bytes], str]]default_encodingcurl_optionszOptional[list]
curl_infos4Optional[Union[CurlHttpVersion, HttpVersionLiteral]]http_versiondebug	interface%Optional[Union[str, tuple[str, str]]]certOptional[type[R]]response_classdiscard_cookiesraise_for_statusrB   NrC   rB   rJ   rK   rN   rN   @   s    &&&&''$$--2255((11AA<<$$""JJ  33))rJ   rN   c                  N   ] tR t^`t$ R]R&   R]R&   R]R&   R]R&   R	]R
&   R]R&   R]R&   R]R&   R]R&   R]R&   R]R&   R]R&   R]R&   R]R&   R]R&   R]R&   R]R&   R ]R!&   R]R"&   R]R#&   R]R$&   R%]R&&   R]R'&   R(]R)&   R*]R+&   R,]R-&   R]R.&   R/]R0&   R1]R2&   R3]R4&   R5]R6&   R7tR8# )9StreamRequestParams"Optional[Union[dict, list, tuple]]r\   AOptional[Union[dict[str, str], list[tuple], str, BytesIO, bytes]]dataOptional[dict | list]jsonrO   rP   rQ   rR   r[   filesrS   rT   3Optional[Union[float, tuple[float, float], object]]r`   &Optional[Union[bool, CurlFollow, str]]rc   Optional[int]re   rU   rV   rW   rX   rY   Optional[bool]r^   refereraccept_encodingOptional[Callable]content_callbackrg   rh   ri   rj   rk   rl   rm   rn   ro   rp   Union[str, Literal[False]]quoters   rt   rv   rw   rx   rd   max_recv_speedOptional[CurlMime]	multipartr]   r{   rB   NrC   rB   rJ   rK   r~   r~   `   s    22OO##&&&&''DD??$$$$--&&,,11AA''<<))JJ  33%%rJ   r~   c                  "    ] tR t^t$ R]R&   RtR# )RequestParamsr   streamrB   NrC   rB   rJ   rK   r   r      s    rJ   r   c                  &    ] tR t^t]R 4       tRtR# )_Unpackc                 	    R # NrB   )argskwargss   *,rK   __getitem___Unpack.__getitem__   s    rJ   rB   N)rD   rE   rF   rG   staticmethodr   rI   rB   rJ   rK   r   r      s    		 
	rJ   r   c                    V ^8  d   QhRRRR/# )   urlr<   returnr]   rB   )formats   "rK   __annotate__r      s     ; ;# ;$ ;rJ   c                j    \        V 4      p\        VP                  ;'       d    VP                  4      # )z,Check if the provided url is an absolute url)r   r]   schemehostname)r   
parsed_urls   & rK   _is_absolute_urlr      s*    #J
!!99j&9&9::rJ   c                   V ^8  d   QhRR/# )r   qzqueue.QueuerB   )r   s   "rK   r   r      s      ; rJ   c                P     V P                   ^ ,          #   \         d    Tu # i ; ir   )queue
IndexErrorr   r8   s   &&rK   _peek_queuer      s)    wwqz     %%c                   V ^8  d   QhRR/# )r   r   zasyncio.QueuerB   )r   s   "rK   r   r      s      } rJ   c                P     V P                   ^ ,          #   \         d    Tu # i ; ir   )_queuer   r   s   &&rK   _peek_aio_queuer      s)    xx{ r   c                  L    ] tR t^t$ R]R&   RtR]R&   RtR]R&   RtR]R	&   R
tR# )RetryStrategyrd   count        floatdelayjitterlinearRetryBackoffbackoffrB   N)	rD   rE   rF   rG   rH   r   r   r   rI   rB   rJ   rK   r   r      s%    JE5FE$G\$rJ   r   c                    V ^8  d   QhRRRR/# )r   rf   #Optional[Union[int, RetryStrategy]]r   r   rB   )r   s   "rK   r   r      s      ? M rJ   c                   V f   ^ p \        V \        4      '       d   T pM.\        V \        4      '       d   \        V R7      pM\        R4      hVP                  ^ 8  d   \        R4      hVP                  ^ 8  d   \        R4      hVP                  ^ 8  d   \        R4      hVP                  R9  d   \        R4      hV# )N)r   z%retry must be an int or RetryStrategyzretry.count must be >= 0zretry.delay must be >= 0zretry.jitter must be >= 0z/retry.backoff must be 'linear' or 'exponential'r   exponential)	
isinstancer   rd   	TypeErrorr   
ValueErrorr   r   r   )rf   strategys   & rK   _normalize_retryr      s    }%''	E3		 u-?@@~~344~~34445588JKKOrJ   c            <          ] tR t^tRtRRRRRRRRRRRRR	RR
RRRR^RRRRR^R^ RRRRRRRRRRRRRRRRRRRRRRRRR RR!RR"RR#R/R$ R% lltR& R' ltR( tR) R* lt]	R+ R, l4       t
]
P                  R- R. l4       t
R/tR# )0BaseSessionzMProvide common methods for setting curl options and reading info in sessions.rP   NrR   rT   rV   rX   rY   rZ   r\   r^   Tr`   ra   rc   re   rf   rh   ri   rj   rk   rm   rn   rp   utf-8rq   rr   rt   ru   Frv   rx   rz   r{   r|   c          <         V ^8  d   QhRRRRRRRRR	R
RRRR
RRRRRRRRRRRRRRRRRR
RR
RR
RR R!RR"R#R$R%R&R'R(R)R*RR+R
R,R-R.R/R0RR1R/# )2r   rP   rO   rR   rQ   rT   rS   rV   rU   rX   rW   rY   rZ   r\   zOptional[dict[str, object]]r^   r]   r`   r_   ra   rc   rb   re   rd   rf   r   rh   rg   ri   rj   rk   rm   rl   rn   rp   ro   rq   zOptional[dict[CurlOpt, str]]rr   zOptional[list[object]]rt   rs   ru   rv   rx   rw   rz   ry   r{   r|   rB   )r   s   "rK   r   BaseSession.__annotate__   s\    W W 'W '	W
 (W %W W .W  W ,W W 3W W 6W W  3!W" 2#W$ %W& 'W( )W* B+W, -W. =/W0 31W2 +3W4 K5W6 7W8 !9W: 4;W< *=W> ?W@ AWrJ   c               	.   \        V4      V n        \        V4      V n        W0n        Wpn        Wn        Wn        Wn        Wn	        Wn
        Wn        \        V4      V n        Wn        VV n        VV n        VV n        VV n        VV n        VV n        T;'       g    / V n        T;'       g    . V n        VV n        VV n        VV n        VV n        Ve$   \7        V\8        4      RJ d   \;        RV R24      hT;'       g    \8        V n        VV n        VV n         V'       d   V'       d   \;        R4      hV'       d   RV/pT;'       g    / V n!        W`n"        V P
                  '       d'   \G        V P
                  4      '       g   \I        R4      hRV n%        V P                  RJ g   V P                  fb   \L        PN                  PQ                  R4      ;'       g4    \L        PN                  PQ                  R	4      ;'       g    V P                  V n        R # R # )
NFzZ`response_class` must be a subclass of `curl_cffi.requests.models.Response`, not of type ``z)Cannot specify both 'proxy' and 'proxies'r=   z2You need to provide an absolute url for 'base_url'TREQUESTS_CA_BUNDLECURL_CA_BUNDLE))r&   rP   r    _cookiesrT   rZ   r\   r^   r`   ra   rc   re   r   rf   rh   ri   rj   rk   rm   rn   rp   rq   rr   rt   ru   rv   rx   
issubclassr,   r   rz   r{   r|   rV   rY   r   r   _closedosenvironget)selfrP   rR   rT   rV   rX   rY   rZ   r\   r^   r`   ra   rc   re   rf   rh   ri   rj   rk   rm   rn   rp   rq   rr   rt   ru   rv   rx   rz   r{   r|   s   &$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$rK   __init__BaseSession.__init__   s   D w'(	 ".*%e,
&	 . 0(..B$**(
"	%*^X*NRW*W  ./q2 
 -88. 0WGHHenG")--R$===!1$--!@!@QRR ;;$$++"5

34  ::>>"23 ;; K #6rJ   c               0    V ^8  d   QhRRRRRRRRRR	R
R/# )r   curlr   bufferr   header_bufferrp   ro   r{   r]   r   r6   rB   )r   s   "rK   r   r   &  sN     T TT T 	T
 =T T 
TrJ   c                	~   Tp\        \        V P                  V4      4      p\        \        VP	                  \
        P                  4      4      P                  4       Vn        V'       d   VP                  4       Vn
        \        \        VP	                  \
        P                  4      4      Vn        \        \        VP	                  \
        P                  4      4      Vn        ^VP                  u;8*  ;'       d    R8  Mu Vn        VP                  4       P#                  4       p. p	V F  p
V
P%                  4       '       g   K  V
P'                  R4      '       d)   VP)                  V
4      P                  4       Vn        . p	KZ  V
P'                  R4      '       g   V
P'                  R4      '       d   V	R;;,          V
,          uu&   K  V	P-                  V
4       K  	  \/        V	4      Vn        \3        4       Vn        VP0                  P7                  R4      pV F  p \8        P4                  P;                  4       pVP=                  V4       VP?                  4        Fg  w  rVP4                  PA                  VVPB                  VPE                  RR4      VPE                  RR	4      \G        VPE                  R
4      4      R7       Ki  	  K  	  T;'       g    V PJ                  pV'       g^   VP	                  \
        PL                  4       Uu. uF  p\N        PP                  ! V4      NK  	  ppV PR                  PU                  V4       \        \        XP	                  \
        PV                  4      4      P                  4       Vn,        \        \        VP	                  \
        PZ                  4      4      Vn.        \        \        VP	                  \
        P^                  4      4      P                  4       Vn0        \        \        VP	                  \
        Pb                  4      4      Vn2        WGn3        \i        \        \j        VP	                  \
        Pl                  4      4      R7      Vn7        \        \        VP	                  \
        Pp                  4      4      Vn9        \        \        VP	                  \
        Pt                  4      4      p VP                  4       Vn;        \        \        VP	                  \
        Pz                  4      4      Vn>        \        \        VP	                  \
        P~                  4      4      Vn@        \        \        VP	                  \
        P                  4      4      VnB        \        \        VP	                  \
        P                  4      4      VnD        VP|                  VP                  ,           VnE        V P                   F!  pVP	                  V4      VP                  V&   K#  	  V#   \H         d     EK  i ; iu upi   \x         d    TP                  R4      Tn;         ELYi ; i)   i  s   HTTP/       	z
set-cookiedomain path/secure)r   r   r   )secondszlatin-1)Hr   r6   rz   bytesgetinfor   EFFECTIVE_URLdecoder   getvaluecontentrd   HTTP_VERSIONrt   RESPONSE_CODEstatus_codeok
splitlinesstrip
startswithget_reason_phrasereasonappendr&   rP   r    rR   get_listr>   SimpleCookieloaditemssetvaluer   r]   	Exceptionr{   
COOKIELISTr"   from_curl_formatr   update_cookies_from_curl
PRIMARY_IP
primary_ipPRIMARY_PORTprimary_portLOCAL_IPlocal_ip
LOCAL_PORT
local_portrp   r   r   
TOTAL_TIMEelapsedREDIRECT_COUNTredirect_countREDIRECT_URLredirect_urlUnicodeDecodeErrorSIZE_DOWNLOAD_Tdownload_sizeSIZE_UPLOAD_Tupload_sizeHEADER_SIZEheader_sizeREQUEST_SIZErequest_sizeresponse_sizerr   infos)r   r   r   r   rp   r{   crspheader_linesheader_listheader_lineset_cookie_headers
set_cookiecookienamemorselmorselsredirect_url_bytesinfos   &&&&&&             rK   _parse_responseBaseSession._parse_response&  sn    1d))!,-uaii(>(>?@GGI //+CKQYYx/D/D%EFsAIIh.D.D$EF--#-$--/::< $&'K$$&&%%h//00=DDF
 %%d++{/E/Ee/L/LB;.{+ ( k* i [[11,?,J224J'$*LLNLDKKOO%zz(B7#ZZ4#FJJx$89 $  %3	 -  *AAT-A-A89		(BUBU8V8V1
++A.8V   MM227;eQYYx/B/B%CDKKMQYYx/D/D%EFE199X->->#?@GGIc199X-@-@#AB/UAIIh>Q>Q4R(ST!#qyy1H1H'IJ!%83H3H)IJ	D188:C !aii0H0H&IJsAIIh.D.D$EFsAIIh.B.B$CDQYYx/D/D%EF--? OODiioCIIdO $ 
E   " 	D188CC	Ds+   B*W?XX ?XX!X<;X<c                	@    V P                   '       d   \        R 4      hR# )z'Session is closed, cannot send request.N)r   r$   r   s   &rK   _check_session_closed!BaseSession._check_session_closed|  s    <<< IJJ rJ   c                    V ^8  d   QhRRRR/# )r   attemptrd   r   r   rB   )r   s   "rK   r   r     s      C E rJ   c                	   V P                   pVP                  R 8X  d#   VP                  ^V^,
          ,          ,          pMVP                  V,          pVP                  '       d)   V\        P
                  ! RVP                  4      ,          pV# )r   r   )rf   r   r   r   randomuniform)r   r2  r   r   s   &&  rK   _retry_delayBaseSession._retry_delay  se    ::},NNaGaK&89ENNW,E???V^^C99ErJ   c                   V ^8  d   QhRR/# )r   r   r    rB   )r   s   "rK   r   r     s       rJ   c                	    V P                   # r   )r   r.  s   &rK   rR   BaseSession.cookies  s    }}rJ   c                    V ^8  d   QhRRRR/# )r   rR   r!   r   NonerB   )r   s   "rK   r   r     s     ) ){ )t )rJ   c                	&    \        V4      V n        R # r   )r    r   )r   rR   s   &&rK   rR   r:    s      (rJ   )r   r   rj   rc   rT   rZ   rx   rr   rq   ru   rp   rn   r{   rm   rP   rt   rh   rv   ri   re   r\   rk   rV   rY   r|   rz   rf   r`   ra   r^   )rD   rE   rF   rG   __doc__r   r+  r/  r6  propertyrR   setterrI   rB   rJ   rK   r   r      s   WW *.W *.	W
 +/W (,W  $W 15W #'W /3W W 68W W 9=W  W  67!W" 59#W$ "%W& !%'W( #)W* EI+W, !%-W. @G/W0 6:1W2 .23W4 NR5W6 7W8 $(9W: 7;;W< -1=W> !&?W@ "'AWrTlK   ^^) )rJ   r   c                     a  ] tR tRtRtR.R V 3R lllt]R 4       t]R 4       tR t	R	 R
 lt
R R lt]R R l4       tR/R R lltR R ltRRRRRRR]RRRRRRRRRRRRRRRRRRRRR^ RR3 R R lltRRRRRRR]RRRRRRRRRRRRRRRRRRRRR^ RR3 R R lltR R ltR R ltR R  ltR! R" ltR# R$ ltR% R& ltR' R( ltR) R* ltR+ R, ltR-tV ;t# )0Sessioni  zA request session, cookies and connections will be reused. This object is
thread-safe, but it's recommended to use a separate session for each thread.Nc          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r   r   zOptional[Curl]threadzOptional[ThreadType]use_thread_local_curlr]   r   Unpack[BaseSessionParams[R]]r   r<  rB   )r   s   "rK   r   Session.__annotate__  sJ     KB KBKB %KB  $	KB
 /KB 
KBrJ   c                  < \         SV `  ! R/ VB  W n        W0n        RV n        RV n        V'       dj   \        P                  ! 4       V n        V'       d   RV n	        WP                  n
        R# RV n	        \        V P                  R7      V P                  n
        R# V'       d   TM\        V P                  R7      V n        R# )a	  
Parameters set in the ``__init__`` method will be overridden by the same
parameter in request method.

Args:
    curl: curl object to use in the session. If not provided, a new one will be
        created. Also, a fresh curl object will always be created when accessed
        from another thread.
    thread: thread engine to use for working with other thread implementations.
        choices: eventlet, gevent.
    headers: headers to use in the session.
    cookies: cookies to add in the session.
    auth: HTTP basic auth, a tuple of (username, password), only basic auth is
        supported.
    proxies: dict of proxies to use, prefer to use proxy if they are the same.
        format: ``{"http": proxy_url, "https": proxy_url}``.
    proxy: proxy to use, format: "http://proxy_url".
        Cannot be used with the above parameter.
    proxy_auth: HTTP basic auth for proxy, a tuple of (username, password).
    base_url: absolute url to use as base for relative urls.
    params: query string for the session.
    verify: whether to verify https certs.
    timeout: how many seconds to wait before giving up.
    trust_env: use http_proxy/https_proxy and other environments, default True.
    allow_redirects: whether to allow redirection. Can be a bool, a
        ``CurlFollow`` value, or the string ``"safe"``. Use
        ``CurlFollow.SAFE`` or ``"safe"`` to reject redirects to
        internal/private IP addresses (SSRF protection).
    max_redirects: max redirect counts, default 30, use -1 for unlimited.
    retry: number of retries or ``RetryStrategy`` for failed requests.
    impersonate: which browser version to impersonate in the session.
    ja3: ja3 string to impersonate in the session.
    akamai: akamai string to impersonate in the session.
    perk: perk string to impersonate in the session.
    extra_fp: extra fingerprints options, in complement to ja3 and akamai str.
    interface: which interface use.
    default_encoding: encoding for decoding response content if charset is not
        found in headers. Defaults to "utf-8". Can be set to a callable for
        automatic detection.
    cert: a tuple of (cert, key) filenames for client cert.
    response_class: A customized subtype of ``Response`` to use.
    raise_for_status: automatically raise an HTTPError for 4xx and 5xx
        status codes.

Notes:
    This class can be used as a context manager.

.. code-block:: python

    from curl_cffi.requests import Session

    with Session() as s:
        r = s.get("https://example.com")
NTFru   rB   )superr   _thread_use_thread_local_curlr   	_executor	threadinglocal_local_is_customized_curlr   r   ru   _curl)r   r   rD  rE  r   	__class__s   &&&&,rK   r   Session.__init__  s    z 	"6"&;# #//+DK+/(#' +0(#'djj#9 !%4djj+ADJrJ   c                	L   V P                   '       d   V P                  '       d   \        P                  ! R \        ^R7       \        V P                  RR4      '       g&   \        V P                  R7      V P                  n	        V P                  P                  # V P                  # )z/Creating fresh curl handle in different thread.)
stacklevelr   NrI  )rL  rQ  warningswarnr   getattrrP  r   ru   r   rR  r.  s   &rK   r   Session.curl  ss    &&&'''E# 
 4;;55#'djj#9 ;;###::rJ   c                	T    V P                   f   \        4       V n         V P                   # r   )rM  r   r.  s   &rK   executorSession.executor  s     >>!/1DN~~rJ   c                	    V # r   rB   r.  s   &rK   	__enter__Session.__enter__  s    rJ   c                   V ^8  d   QhRR/# r   r   r<  rB   )r   s   "rK   r   rG    s       rJ   c                	&    V P                  4        R # r   closer   r   s   &*rK   __exit__Session.__exit__  s    

rJ   c                   V ^8  d   QhRR/# rb  rB   )r   s   "rK   r   rG     s      t rJ   c                H    RV n         V P                  P                  4        R# )Close the session.TN)r   r   re  r.  s   &rK   re  Session.close   s    		rJ   c               (    V ^8  d   QhRRRRRRRR/# )	r   method
HttpMethodr   r<   r   Unpack[StreamRequestParams]r   zGenerator[R, None, None]rB   )r   s   "rK   r   rG    s2        .	
 
"rJ   c              +     "   V P                   ! RRVRV/VBRR/B p Vx  VP                  4        R#   TP                  4        i ; i5i)z6Equivalent to ``with request(..., stream=True) as r:``rn  r   r   TNrB   )requestre  r   rn  r   r   r  s   &&&, rK   r   Session.stream  sC      llI&IcIVIDI	IIIKCIIKs   A	4 A	AA	c                    V ^8  d   QhRRRR/# )r   r   r<   r   r3   rB   )r   s   "rK   r   rG    s     1 11 
1rJ   c           	        V P                  4        V P                  P                  4       pV P                  P                  4        \	        VVVVVV P
                  R7      p\        \        R,          VP                  R4      4      p	V	e,   \        V P                  4      p
V
P                  V	4       WR&   MV P                  VR&   VP                  ! V3/ VB  V# )a  Connects to a websocket url.

Note: This method is deprecated, use WebSocket instead.

Args:
    url: the ws url to connect.
    on_message: message callback, ``def on_message(ws, str)``
    on_error: error callback, ``def on_error(ws, error)``
    on_open: open callback, ``def on_open(ws)``
    on_close: close callback, ``def on_close(ws)``

Other parameters are the same as ``.request``

Returns:
    a WebSocket instance to communicate with the server.
)r   
on_messageon_erroron_openon_closeru   NrR   )r/  r   	duphandleresetr3   ru   r   r    r   rR   updateconnect)r   r   rw  rx  ry  rz  r   r   r@   user_cookiesmerged_cookiess   &&&&&&,    rK   
ws_connectSession.ws_connect  s    2 	""$yy""$		!!**
 GdNFJJy,AB#$T\\2N!!,/ .9 $F9


3!&!	rJ   c                   V ^8  d   QhRR/# )r   r   rd   rB   )r   s   "rK   r   rG  F  s     " " "rJ   c                	6    V P                   P                  4       # r   )r   upkeepr.  s   &rK   r  Session.upkeepF  s    yy!!rJ   gzip, deflate, brr   r   Fc          F         V ^8  d   QhRRRRRRRRR	R
RRRRRRRRRRRRRRRRRRRRRRR RR!RR"R#R$R%R&RR'RR(RR)R*R+RR,R-R.R/R0R1R2RR3R4R5RR6R7R8R9R:R;R<R=/## )>r   rn  ro  r   r<   r\   zDOptional[Union[dict[str, object], list[object], tuple[object, ...]]]r   zNOptional[Union[dict[str, str], list[tuple[object, ...]], str, BytesIO, bytes]]r   r   rP   rO   rR   rQ   r   r[   rT   rS   r`   r   rc   r   re   r   rV   rU   rX   rW   rY   r^   r   r   r   r   zOptional[Callable[..., object]]rh   rg   ri   rj   rk   rm   rl   rn   rp   ro   r   r   rt   +CurlHttpVersion | HttpVersionLiteral | Nonerv   rx   rw   r   r   rd   r   r   r{   r]   r   r6   rB   )r   s   "rK   r   rG  I  s    d dd d
	d
d $d 'd 'd d (d Ed  @!d" %#d$ %%d& 'd( .)d* +d, -d. '/d0 :1d2 23d4 5d6 7d8 9d: B;d< (=d> =?d@ *AdB BCdD !EdF 4GdH IdJ KdL &MdN OdP 
QdrJ   c#           	     	^	  a aa"a-a.a/a0a1a2 V'       d6   S P                   P                  4       o.S P                   P                  4       p#MS P                   o.\        S.3/ R VbRVbRS P                  V.bRS P
                  bRVbRVbRS P                  V.bRS P                  V.bRVbR	T	;'       g    S P                  bR
V
\        J d   S P                  MT
bRVf   S P                  MTbRVf   S P                  MTbRS P                  V.bRVbRT;'       g    S P                  bRS P                  V.bRVbRVbRVbRT;'       g    S P                   bRT;'       g    S P"                  bRT;'       g    S P$                  bRT;'       g    S P&                  bRT;'       g    S P(                  bRVf   S P*                  MTbRVbRT;'       g    S P,                  bRT;'       g    S P.                  bRVbRV bR V!bR!T;'       g    S P0                  bR"S P2                  bR#\4        P6                  bR$\8        P:                  b w  o2o-o/o1o0p$V'       d   V-V.VV"V/V0V1V2V 3	R% lp%S P<                  P?                  V%4      p&S0PA                  4        S PC                  S.S-S/SS"4      p'\E        S14      p(\G        V(\H        4      '       d;   V$'       d   V$PK                  4        V&PM                  4        S.PO                  4        V(hS2V'n(        V&V'n)        V$V'n*        S1V'n        S PV                  '       d   V'PW                  4        V'#  S PX                  R&8X  d+   ^ RI-p)V)P\                  P_                  S.P`                  4       MgS PX                  R'8X  dG   ^ RI1p*V*Pe                  4       Pf                  Pi                  S.P`                  4      Pk                  4        MS.Pa                  4        S PC                  S.S-S/SS"4      p'S2V'n(        S PV                  '       d   V'PW                  4        V'S.P                  4        #   \l         d_   p+S PC                  S.S-S/SS"4      p'S2T'n(        \o        T+Pp                  \s        T+4      4      p,T,! \s        T+4      T+Pp                  T'4      T+hRp+?+ii ; i  S.P                  4        i ; i)(rn  r   params_listrZ   r   r   headers_listcookies_listr   rT   r`   rc   Nre   proxies_listrX   rY   verify_listr   r   r   rh   ri   rj   rk   rm   rn   r   rt   rv   r   r   r   rx   rq   queue_classevent_classc                   <	  SP                  4        \        \        P                  S4      P                  4       '       g)   \        \        P                  S4      P                  4        SP                  \        4       R #   \         dV   p S
P                  SSSSS4      pS	Tn        SP	                  \        \        T 4      T P                  T4      4        R p ? LR p ? ii ; i  \        \        P                  S4      P                  4       '       g)   \        \        P                  S4      P                  4        SP                  \        4       i ; ir   )performr   r+  rr  
put_nowaitr#   r<   coder   rN  Eventis_setr   putr+   )er  r   r  rp   r{   r   header_recvedr   reqr   s     rK   r  &Session._request_once.<locals>.perform  s    &IIK  	?FFHHY__m<@@BEE*% ! H..6=2BOC #&CKLL!1#a&!&&#!FGGH  	?FFHHY__m<@@BEE*%s+   B   C ACC# C  C# #A-Eeventletgevent):r   r{  r|  r0   r\   rZ   rP   r   rT   r-   r`   rc   re   rV   rY   r^   rh   ri   rj   rk   rm   rn   rt   rv   rx   rq   r   QueuerN  r  r\  submitwaitr+  r   r   r#   r   resultre  rr  stream_taskquit_nowr|   rK  eventlet.tpooltpoolexecuter  r  get_hub
threadpoolspawnr   r   r%   r  r<   )3r   rn  r   r\   r   r   rP   rR   r   rT   r`   rc   re   rV   rX   rY   r^   r   r   r   rh   ri   rj   rk   rm   rn   rp   r   rt   rv   rx   r   r   r   r{   _r  r  r  r  first_elementr  r  r  errorr   r  r   r  r   r  s3   f&&&&&&&&&&&&&&&&&&&&&&&&&f&&&&&&&f          @@@@@@rK   _request_onceSession._request_onceI  s   T 		##%A		!A		AAQ,B
,B
 ,B
 f-	,B

 ]],B
 ,B
 ,B
 ,,0,B
 --1,B
 ,B
 "",B
 %,w$6DLLG,B
 )8(?$$_,B
" '4&;""#,B
& ,,0',B
( ),B
* "44T__+,B
, f--,B
. /,B
0 ,1,B
2 .3,B
4 $77t'7'75,B
6 txx7,B
8 ((T[[9,B
: "";,B
< ..=,B
@ )8(?$$_A,B
D E,B
F &::):):G,B
H  114>>I,B
J K,B
L *M,B
N  O,B
P ""Q,B
R **S,B
T U,B
V "W,B
>V]A}h\ & & --..w7K  &&6=*:OC
 (NM-)9::LLN""$	##CK)CO#CLCI$$$$$&J<<:-)NN**1995\\X-!NN$//55aii@DDFIIK **v}.> "(((((*	!  8**v}.> ""1663q62CFAFFC0a78  	s,   <B"P. ?R .R9ARRR R,c          D         V ^8  d   QhRRRRRRRRR	R
RRRRRRRRRRRRRRRRRRRRRRR RR!RR"R#R$R%R&RR'RR(RR)R*R+RR,R-R.R/R0R1R2RR3R4R5RR6R7R8R9R:R;/"# )<r   rn  ro  r   r<   r\   r   r   r   r   r   rP   rO   rR   rQ   r   r[   rT   rS   r`   r   rc   r   re   r   rV   rU   rX   rW   rY   r^   r   r   r   r   r   rh   rg   ri   rj   rk   rm   rl   rn   rp   ro   r   r   rt   rs   rv   rx   rw   r   r   rd   r   r   r{   r]   rB   )r   s   "rK   r   rG    s    U& U&U& U& 3	U&
 PU& $U& 'U& 'U& U& (U& EU& @U& %U& %U& U&  .!U&" #U&$ %U&& ''U&( -)U&* 2+U&, -U&. /U&0 1U&2 B3U&4 (5U&6 =7U&8 *9U&: K;U&< !=U&> 4?U&@ AU&B CU&D &EU&F GU&rJ   c#                ,   V P                  4        V P                  p#\        V#P                  ^,           4       Fz  p$ V P                  ! R$/ RVbRVbRVbRVbRVbRVbRVbRVbR	V	bR
V
bRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbR V bR!V!bR"V"b u # 	  R##   \
         dP    T$T#P                  8X  d   h T P                  T$^,           4      p%T%'       d   \        P                  ! T%4        K   K  i ; i)%zESend the request, see ``requests.request`` for details on parameters.rn  r   r\   r   r   rP   rR   r   rT   r`   rc   re   rV   rX   rY   r^   r   r   r   rh   ri   rj   rk   rm   rn   rp   r   rt   rv   rx   r   r   r   r{   NrB   )	r/  rf   ranger   r  r#   r6  timesleep&r   rn  r   r\   r   r   rP   rR   r   rT   r`   rc   re   rV   rX   rY   r^   r   r   r   rh   ri   rj   rk   rm   rn   rp   r   rt   rv   rx   r   r   r   r{   r   r2  r   s&   &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&   rK   rr  Session.request  s   N 	""$::X^^a/0G*&)) #!## "# 	#
 # $# $#  # # $# %4# #0# $#  #  *#  "!#" $##$ %4%#& &6'#( !,)#* +#, "-#. /#0 &1#2 %43#4 &65#6  7#8 ".9#: (;#< =#> "?#@ $2A#B (C#D %4E# # 1L $ &hnn,))'A+6JJu% 	&s   A5B99<D6DDc               $    V ^8  d   QhRRRRRR/# r   r   r<   r   zUnpack[RequestParams]r   r6   rB   )r   s   "rK   r   rG  F  "     > > >'< > >rJ   c                	.    V P                   ! RR RRV/VB # )rn  HEADr   rB   rr  r   r   r   s   &&,rK   headSession.headF      ||=6=s=f==rJ   c               $    V ^8  d   QhRRRRRR/# r  rB   )r   s   "rK   r   rG  I  "     = =s =&; = =rJ   c                	.    V P                   ! RR RRV/VB # )rn  GETr   rB   r  r  s   &&,rK   r   Session.getI      ||<5<c<V<<rJ   c               $    V ^8  d   QhRRRRRR/# r  rB   )r   s   "rK   r   rG  L  r  rJ   c                	.    V P                   ! RR RRV/VB # )rn  POSTr   rB   r  r  s   &&,rK   postSession.postL  r  rJ   c               $    V ^8  d   QhRRRRRR/# r  rB   )r   s   "rK   r   rG  O  r  rJ   c                	.    V P                   ! RR RRV/VB # )rn  PUTr   rB   r  r  s   &&,rK   r  Session.putO  r  rJ   c               $    V ^8  d   QhRRRRRR/# r  rB   )r   s   "rK   r   rG  R  "     ? ? ?(= ?! ?rJ   c                	.    V P                   ! RR RRV/VB # )rn  PATCHr   rB   r  r  s   &&,rK   patchSession.patchR      ||>7>>v>>rJ   c               $    V ^8  d   QhRRRRRR/# r  rB   )r   s   "rK   r   rG  U  s'     @ @# @)> @1 @rJ   c                	.    V P                   ! RR RRV/VB # )rn  DELETEr   rB   r  r  s   &&,rK   deleteSession.deleteU  s    ||?8????rJ   c               $    V ^8  d   QhRRRRRR/# r  rB   )r   s   "rK   r   rG  X  s'     A A3 A*? AA ArJ   c                	.    V P                   ! RR RRV/VB # )rn  OPTIONSr   rB   r  r  s   &&,rK   optionsSession.optionsX  s    ||@9@#@@@rJ   c               $    V ^8  d   QhRRRRRR/# r  rB   )r   s   "rK   r   rG  [  r  rJ   c                	.    V P                   ! RR RRV/VB # )rn  TRACEr   rB   r  r  s   &&,rK   traceSession.trace[  r  rJ   c               $    V ^8  d   QhRRRRRR/# r  rB   )r   s   "rK   r   rG  ^  r  rJ   c                	.    V P                   ! RR RRV/VB # )rn  QUERYr   rB   r  r  s   &&,rK   querySession.query^  r  rJ   )r   rR  rM  rQ  rP  r   rK  rL  )NNT)NNNN)rD   rE   rF   rG   r>  r   r?  r   r\  r_  rg  re  r	   r   r  r  r-   r  rr  r  r   r  r  r  r  r  r  r  rI   __classcell__rS  s   @rK   rB  rB    sx   TKB KBZ    

  1f"  &*)-)- $*.GNBF'+'+#04!%!%)<<@48! $"DH*.?F,.DH#'6:!%(, %OdT 6:RV&*)-)- $*.GNBF'+'+#04!%!%)</348! $"DH*.?F,.MQ#'6:!%(, %GU&n>=>=?@A?? ?rJ   rB  c            $      0  a  ] tR tRtRtRRRRR^
/R V 3R lllt]R	 R
 l4       t]R R l4       tR t	R R lt
R R ltR tR R ltR R ltR R lt]R R l4       tRRRRR]RRRRRRRRRRRRRRRRRR^ ^ ^^ RRRR R;RRR3$R! R" lltRRRRRRR]RRRRRRRRRRRRRRRR#RRRRR^ RR3 R$ R% lltRRRRRRR]RRRRRRRRRRRRRRRR#RRRRR^ RR3 R& R' lltR( R) ltR* R+ ltR, R- ltR. R/ ltR0 R1 ltR2 R3 ltR4 R5 ltR6 R7 ltR8 R9 ltR:tV ;t # )<AsyncSessionib  zAAn async request session, cookies and connections will be reused.loopN
async_curlmax_clientsc          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r   r  z asyncio.AbstractEventLoop | Noner  zAsyncCurl | Noner  rd   r   rF  r   r<  rB   )r   s   "rK   r   AsyncSession.__annotate__e  sE     E E /E %	E
 E /E 
ErJ   c               l   < \         SV `  ! R/ VB  Wn        W n        W0n        V P                  4        R# )a[
  
Parameters set in the ``__init__`` method are overridden by the same parameter
in request method.

Parameters:
    loop: loop to use, if not provided, the running loop will be used.
    async_curl: [AsyncCurl](/api/curl_cffi#curl_cffi.AsyncCurl) object to use.
    max_clients: maxmium curl handle to use in the session,
        this will affect the concurrency ratio.
    headers: headers to use in the session.
    cookies: cookies to add in the session.
    auth: HTTP basic auth, a tuple of (username, password), only basic auth is
        supported.
    proxies: dict of proxies to use, prefer to use ``proxy`` if they are the
        same. format: ``{"http": proxy_url, "https": proxy_url}``.
    proxy: proxy to use, format: "http://proxy_url".
        Cannot be used with the above parameter.
    proxy_auth: HTTP basic auth for proxy, a tuple of (username, password).
    base_url: absolute url to use for relative urls.
    params: query string for the session.
    verify: whether to verify https certs.
    timeout: how many seconds to wait before giving up.
    trust_env: use http_proxy/https_proxy and other environments, default True.
    allow_redirects: whether to allow redirection. Can be a bool, a
        ``CurlFollow`` value, or the string ``"safe"``. Use
        ``CurlFollow.SAFE`` or ``"safe"`` to reject redirects to
        internal/private IP addresses (SSRF protection).
    max_redirects: max redirect counts, default 30, use -1 for unlimited.
    retry: number of retries or ``RetryStrategy`` for failed requests.
    impersonate: which browser version to impersonate in the session.
    ja3: ja3 string to impersonate in the session.
    akamai: akamai string to impersonate in the session.
    perk: perk string to impersonate in the session.
    extra_fp: extra fingerprints options, in complement to ja3 and akamai str.
    default_encoding: encoding for decoding response content if charset is not
        found in headers. Defaults to "utf-8". Can be set to a callable for
        automatic detection.
    cert: a tuple of (cert, key) filenames for client cert.
    response_class: A customized subtype of ``Response`` to use.
    raise_for_status: automatically raise an HTTPError for 4xx and 5xx
        status codes.

Notes:
    This class can be used as a context manager, and it's recommended to use via
    ``async with``.
    However, unlike aiohttp, it is not required to use ``with``.

.. code-block:: python

    from curl_cffi.requests import AsyncSession

    # recommended.
    async with AsyncSession() as s:
        r = await s.get("https://example.com")

    s = AsyncSession()  # it also works.
NrB   )rJ  r   _loop_acurlr  	init_pool)r   r  r  r  r   rS  s   &$$$,rK   r   AsyncSession.__init__e  s0    B 	"6"7;
(2 +rJ   c                   V ^8  d   QhRR/# )r   r   zasyncio.AbstractEventLooprB   )r   s   "rK   r   r    s      / rJ   c                j    V P                   f   \        P                  ! 4       V n         V P                   # )z"Returns a reference to event loop.)r  asyncioget_running_loopr.  s   &rK   r  AsyncSession.loop  s(     :: 113DJzzrJ   c                   V ^8  d   QhRR/# )r   r   r   rB   )r   s   "rK   r   r    s      y rJ   c                	l    V P                   f   \        V P                  R7      V n         V P                   # )N)r  )r  r   r  r.  s   &rK   acurlAsyncSession.acurl  s&    ;;#3DK{{rJ   c                	    \         P                  ! V P                  4      V n          V P                  P	                  R4       K    \         P
                   d     R# i ; i)TN)r  	LifoQueuer  poolr  	QueueFullr.  s   &rK   r  AsyncSession.init_pool  sL    4;4E4EdFVFV4W			$$T*$$ s   A AAc                   V ^8  d   QhRR/# )r   r   r   rB   )r   s   "rK   r   r    s       rJ   c                	   "   V P                   P                  4       G R j  xL
 pVf   \        V P                  R7      pV#  L 5i)NrI  )r  r   r   ru   r   r   s   & rK   pop_curlAsyncSession.pop_curl  s4     "&))--/1<djj)D 2s   AA!Ac                    V ^8  d   QhRRRR/# )r   r   zCurl | Noner   r<  rB   )r   s   "rK   r   r    s     ' 'k 'd 'rJ   c                	    \        \        P                  4      ;_uu_ 4        V P                  P	                  V4       R R R 4       R #   + '       g   i     R # ; ir   )r
   r  r  r  r  r	  s   &&rK   	push_curlAsyncSession.push_curl  s4    g''((II  & )(((s   AA	c                	   "   V # 5ir   rB   r.  s   &rK   
__aenter__AsyncSession.__aenter__  s
     s   c                   V ^8  d   QhRR/# rb  rB   )r   s   "rK   r   r    s       rJ   c                	B   "   V P                  4       G R j  xL
  R #  L5ir   rd  rf  s   &*rK   	__aexit__AsyncSession.__aexit__  s     jjl 	s   c                   V ^8  d   QhRR/# rb  rB   )r   s   "rK   r   r    s     
 
T 
rJ   c                  "   V P                   P                  4       G Rj  xL
  RV n          V P                  P	                  4       pV'       d   VP                  4        K6  K8   LC  \
        P                   d     R# i ; i5i)rk  NT)r   re  r   r  
get_nowaitr  
QueueEmptyr	  s   & rK   re  AsyncSession.close  sk     jj   yy++-JJL  	! %% s8   BA$B!A& A&  B&A?;B>A??Bc                    V ^8  d   QhRRRR/# )r   r   r   r   r<  rB   )r   s   "rK   r   r    s       $ rJ   c                	    VP                  4        V P                  '       g?   V P                  P                  V4       VP	                  4        V P                  V4       R # VP                  4        R # r   )clean_handles_and_buffersr   r   remove_handler|  r  re  r	  s   &&rK   release_curlAsyncSession.release_curl  sG    &&(|||JJ$$T*JJLNN4 JJLrJ   c               (    V ^8  d   QhRRRRRRRR/# )	r   rn  ro  r   r<   r   rp  r   zAsyncGenerator[R, None, None]rB   )r   s   "rK   r   r    s2        .	
 
'rJ   c                  "   V P                   ! RRVRV/VBRR/B G Rj  xL
 p V5x  VP                  4       G Rj  xL
  R#  L$ L  TP                  4       G Rj  xL 
  i ; i5i)z<Equivalent to ``async with request(..., stream=True) as r:``rn  r   r   TNrB   )rr  aclosers  s   &&&, rK   r   AsyncSession.stream  s]      LLOOCO6O$OO	I**,	 P #**,sA   A'AA'A	 A'AA'A'	A$A A$$A'Tr  r   Fg{Gzt?gMbP?c          L         V ^8  d   QhRRRRRRRRR	R
RRRRRRRRRRRRRRRRRRRRRRRRRRR RR!R"R#RR$R%R&R'R(RR)R*R+R,R-R,R.R,R/R,R0RR1R2R3R4R5R4R6R,R7RR8RR9R:R;R</&# )=r   r   r<   	autocloser]   r\   z<dict[str, object] | list[object] | tuple[object, ...] | NonerP   zHeaderTypes | NonerR   zCookieTypes | NonerT   ztuple[str, str] | Noner`   z/float | tuple[float, float] | NotSetType | Nonerc   zbool | CurlFollow | str | Nonere   z
int | NonerV   zProxySpec | NonerX   z
str | NonerY   r^   zbool | Noner   r   rh   zBrowserTypeLiteral | Noneri   rj   rk   rm   z&ExtraFingerprints | ExtraFpDict | Nonern   r   zstr | Literal[False]rt   r  rv   rx   zstr | tuple[str, str] | Noner   rd   recv_queue_sizesend_queue_sizemax_send_batch_sizecoalesce_framesws_retryzWebSocketRetryStrategy | Nonerecv_time_slicer   send_time_slicemax_message_sizedrain_on_errorblock_on_recv_queue_fullrq   zdict[CurlOpt, str] | Noner   r2   rB   )r   s   "rK   r   r    s    6 66 6 M	6
 $6 $6 %6 A6 86 "6 "6 6 +6 6 6  $!6" /#6$ %6& '6( )6* 9+6, %-6. $/60 B162 364 +566 768 96: ;6< !=6> ?6@ 0A6B C6D E6F G6H I6J #'K6L 0M6N 
O6rJ   c&           &        a aaaaaaaaa	a
aaaaaaaaaaaaaaaaaaaaa a!a"a#a$a% R VVVVVV$VVVV%VV#VVVVVVV"VV	VVV
VVVVV VV VV!VVVV3%R llp&\        V&! 4       4      # )a  Connects to a WebSocket.

Args:
    url: url for the requests.
    autoclose: whether to close the WebSocket after receiving a close frame.
    params: query string for the requests.
    headers: headers to send.
    cookies: cookies to use.
    auth: HTTP basic auth, a tuple of (username, password), only basic auth is
        supported.
    timeout: how many seconds to wait before giving up.
    allow_redirects: whether to allow redirection. Can be a bool, a
        ``CurlFollow`` value, or the string ``"safe"``. Use
        ``CurlFollow.SAFE`` or ``"safe"`` to reject redirects to
        internal/private IP addresses (SSRF protection).
    max_redirects: max redirect counts, default 30, use -1 for unlimited.
    proxies: dict of proxies to use, prefer to use ``proxy`` if they are the
        same. format: ``{"http": proxy_url, "https": proxy_url}``.
    proxy: proxy to use, format: "http://user@pass:proxy_url".
        Can't be used with `proxies` parameter.
    proxy_auth: HTTP basic auth for proxy, a tuple of (username, password).
    verify: whether to verify https certs.
    referer: shortcut for setting referer header.
    accept_encoding: shortcut for setting accept-encoding header.
    impersonate: which browser version to impersonate.
    ja3: ja3 string to impersonate.
    akamai: akamai string to impersonate.
    perk: perk string to impersonate.
    extra_fp: extra fingerprints options, in complement to ja3 and akamai str.
    default_headers: whether to set default browser headers.
    quote: Set characters to be quoted, i.e. percent-encoded. Default safe
        string is ``!#$%&'()*+,/:;=?@[]~``. If set to a string, the character
        will be removed from the safe string, thus quoted. If set to False, the
        url will be kept as is, without any automatic percent-encoding, you must
        encode the URL yourself.
    http_version: limiting http version, defaults to http2.
    interface: which interface to use.
    cert: a tuple of (cert, key) filenames for client cert.
    max_recv_speed: maximum receive speed, bytes per second.
    recv_queue_size: The maximum number of incoming WebSocket
        messages to buffer internally. This queue stores messages received by
        the Curl socket that are waiting to be consumed on calling ``recv()``.
    send_queue_size: The maximum number of outgoing WebSocket
        messages to buffer before applying network backpressure. When you call
        ``send()`` the message is placed in this queue and transmitted when
        the Curl socket is next available for sending.
    max_send_batch_size: The max batch size for sent frames.
    coalesce_frames: When set, multiple pending messages in the send queue
        may be merged into a single WebSocket frame for improved throughput.
        **Warning:** This breaks the one-to-one mapping of ``send()`` calls
        to frames and should only be used when the application protocol is
        designed to handle concatenated data streams. Defaults to ``False``.
    ws_retry (WebSocketRetryStrategy): Retry policy for WebSocket messages.
    recv_time_slice: The maximum duration (in seconds) to process incoming
        messages before yielding to the event loop.
        Defaults to ``0.005`` (5ms).
    send_time_slice: The maximum duration (in seconds) to process outgoing
        messages before yielding to the event loop.
        Defaults to ``0.001`` (1ms).
    max_message_size: Maximum allowed size for a complete received
        WebSocket message (default: ``4 MiB``).
    drain_on_error: If ``True``, when a connection error occurs,
    attempt to consume all the buffered received messages first,
    before raising the error. Otherwise, raise it immediately (default).
    block_on_recv_queue_full (bool, optional): If ``False``, the connection
        is failed immediately when the receive queue is full. The message that
        caused the overflow is not delivered; any messages already buffered may
        still be drained if ``drain_on_error=True``.
    curl_options: extra curl options to use.
c                   V ^8  d   QhRR/# )r   r   r1   rB   )r   s   "rK   r   -AsyncSession.ws_connect.<locals>.__annotate__d  s     N	 N	^ N	rJ   c                   <%"   S!P                  4        S!P                  4       G R j  xL
 p \        R!/ RV bRRbRS%bRS!P                  bRS!P                  S.bRS!P
                  S.bRS!P                  S.bR	S;'       g    S!P                  bR
S$\        J d   S!P                  MS$bRSf   S!P                  MSbRSf   S!P                  MSbRS!P                  S.bRSbRS;'       g    S!P                  bRS!P                  S&.bRS bRSbRS;'       g    S!P                  bRS;'       g    S!P                   bRS;'       g    S!P"                  bRS;'       g    S!P$                  bRSf   S!P&                  MSbRSbRS;'       g    S!P(                  bRS;'       g    S!P*                  bRSbRS	;'       g    S!P,                  bR\.        P0                  bR\.        P2                  bRSb pV P5                  \6        P8                  ^4      pV P5                  \6        P:                  ^4      p S!P<                  P?                  R V P@                  4      G R j  xL
 p\I        \K        \L        \N        ,          S!4      T SSS"SS
S'SS#SSSS!PP                  R 7      p TPS                  4        T#  EL LV  \B         d$    T PE                  4        S!PG                  R 4       h i ; i  \T         d    TPW                  4        h i ; i5i)"Nr   rn  r  r   rZ   r  r  r  rT   r`   rc   re   r  rX   rY   r  r   r   rh   ri   rj   rm   rn   r   rt   rv   r   rx   r  r  rq   )r'  r(  r)  r*  r+  r,  r-  r.  r/  r0  r1  ru   rB   ),r/  r
  r0   rZ   r\   rP   rR   rT   r-   r`   rc   re   rV   rY   r^   rh   ri   rj   rm   rn   rt   rv   rx   r  r  r  setoptr   TCP_NODELAYCONNECT_ONLYr  run_in_executorr  r  re  r  r1   r   r  r,   ru   _start_io_tasksr4   	terminate)(r   r  r@   r   rj   rc   rT   r'  r1  rx   r+  rR   rq   rn   r0  rm   rP   rt   rh   rv   ri   r/  r   re   r*  r\   rV   rX   rY   r   r(  r-  r   r   r)  r.  r`   r   r^   r,  s(      rK   _connect_coro.AsyncSession.ws_connect.<locals>._connect_corod  sF    &&(#}}.D  %%% % 	%
 "[[&1% #llG4% #llG4% &&TYY% )07(:% -<,CD((% +8*?D&&]%  #llG4!%" #%$ &88%%& "[[&1'%(  )%* !0+%, (;;4+;+;-%. OO488/%0 ,,1%2 "22T]]3%6 -<,CD((7%: ;%< *>>T->->=%> $55t~~?%@  .A%B &&TYYC%D $MME%F $MMG%H *I%AL G//3A$$A
))33D$,,GG "0\(+T2# / /$7 /! / /!1-)Ajj"B"""$
 IW /\ H 

t$0 " s   $K?J)AK? A'K?(+K?K?+K?K?,K?K?K?7A4K?,)J. J,J. <K?K 'K?,J. ..KK?K<<K?)r2   )'r   r   r'  r\   rP   rR   rT   r`   rc   re   rV   rX   rY   r^   r   r   rh   ri   rj   rk   rm   rn   r   rt   rv   rx   r   r(  r)  r*  r+  r,  r-  r.  r/  r0  r1  rq   r<  s'   fffffffffffffffffff&ffffffffffffffffff rK   r  AsyncSession.ws_connect  s<    ^N	 N	 N	 N	 N	 N	` %]_55rJ   r   c          F         V ^8  d   QhRRRRRRRRR	R
RRRRRRRRRRRRRRRRRRRRRRR RR!RR"R#R$R%R&RR'RR(RR)R*R+RR,R-R.R/R0R1R2RR3R4R5RR6R7R8R9R:R;R<R=/## >r   rn  ro  r   r<   r\   r   r   r   r   r   rP   rO   rR   rQ   r   r[   rT   rS   r`   r   rc   r   re   r   rV   rU   rX   rW   rY   r^   r   r   r   r   r   rh   rg   ri   rj   rk   rm   rl   rn   rp   ro   r   r   rt   rs   rv   rx   rw   r   r   rd   r   r   r{   r]   r   r6   rB   )r   s   "rK   r   r    s    T( T(T( T( 3	T(
 PT( $T( 'T( 'T( T( (T( ET( @T( %T( %T( T(  .!T(" #T($ %T(& ''T(( -)T(* 2+T(, -T(. /T(0 1T(2 B3T(4 (5T(6 =7T(8 *9T(: K;T(< !=T(> 4?T(@ AT(B CT(D &ET(F GT(H 
IT(rJ   c#                	  a aa"a+a,a-a.a/a0a1"   S P                  4       G R j  xL
 o,\        R)/ RS,bRVbRVbRS P                  V.bRS P                  bRVbRVbRS P                  V.bR	S P
                  V.bR
VbRT	;'       g    S P                  bRV
\        J d   S P                  MT
bRVf   S P                  MTbRVf   S P                  MTbRS P                  V.bRVbRT;'       g    S P                  bRS P                  V.bRVbRVbRVbRT;'       g    S P                  bRT;'       g    S P                  bRT;'       g    S P                   bRT;'       g    S P"                  bRT;'       g    S P$                  bRVf   S P&                  MTbRVbRT;'       g    S P(                  bRT;'       g    S P*                  bRVbR V bR!V!bR"T;'       g    S P,                  bR#S P.                  bR$\0        P2                  bR%\0        P4                  b w  o0o+o-o/o.p#V'       Ed   S P6                  P9                  S,4      o1R& V+V,VV"V-V.V/V0V V13
R' llp$V,V 3R( lp%\0        P:                  ! V$! 4       4      p&V&P=                  V%4       \?        \0        P4                  S.4      PA                  4       G R j  xL
  S PC                  S,S+S-SS"4      p'\E        S/4      p(\G        V(\H        4      '       d   S PK                  S,4       V(hS0V'n&        V&V'n'        V#V'n(        S/V'n)        S PT                  '       d   V'PU                  4        V'#  S P6                  P9                  S,4      o1S1G R j  xL
  S PC                  S,S+S-SS"4      p'S0V'n&        S PT                  '       d   V'PU                  4        V'S PK                  S,4       #  EL EL L[  \V         d_   p)S PC                  S,S+S-SS"4      p'S0T'n&        \Y        T)PZ                  \]        T)4      4      p*T*! \]        T)4      T)PZ                  T'4      T)hR p)?)ii ; i  S PK                  S,4       i ; i5i)*Nr   rn  r   r  rZ   r   r   r  r  r   rT   r`   rc   re   r  rX   rY   r  r   r   r   rh   ri   rj   rk   rm   rn   r   rt   rv   r   r   r   rx   rq   r  r  c                   V ^8  d   QhRR/# rb  rB   )r   s   "rK   r   0AsyncSession._request_once.<locals>.__annotate__  s     , ,4 ,rJ   c                   <
"    SG R j  xL
  \        \        P                  S4      P                  4       '       g)   \        \        P                  S4      P                  4        SP                  \        4      G R j  xL
  R #  Ly  \          dV   p S
P                  SSSSS4      pS	Tn        SP                  \	        \        T 4      T P                  T4      4        R p ? LR p ? ii ; i Lk  \        \        P                  S4      P                  4       '       g)   \        \        P                  S4      P                  4        SP                  \        4      G R j  xL 
  i ; i5ir   )r   r+  rr  r  r#   r<   r  r   r  r  r  r   r  r+   )r  r  r   r   rp   r{   r   r  r   r  r   tasks     rK   r  +AsyncSession._request_once.<locals>.perform  s     ,JJ  }=DDFFW]]M:>>@%%
+++   H..fm5EC #&CKLL!1#a&!&&#!FGGH ,  }=DDFFW]]M:>>@%%
+++sj   E$B BB A.E$=C)>E$B C&AC!C+ !C&&C+ )E$+A/E!EE!!E$c                *   < SP                  S4       R # r   )r   )futr   r   s   &rK   cleanup+AsyncSession._request_once.<locals>.cleanup  s    !!$'rJ   rB   )/r
  r0   r\   rZ   rP   rR   rT   r-   r`   rc   re   rV   rY   r^   rh   ri   rj   rk   rm   rn   rt   rv   rx   rq   r  r  r  r   
add_handlecreate_taskadd_done_callbackr   r  r+  r   r   r#   r   rr  astream_taskr  r   r|   r   r%   r  r<   )2r   rn  r   r\   r   r   rP   rR   r   rT   r`   rc   re   rV   rX   rY   r^   r   r   r   rh   ri   rj   rk   rm   rn   rp   r   rt   rv   rx   r   r   r   r{   r  r  rI  r  r  r  r  r  r   r   r   r  r   r  rE  s2   f&&&&&&&&&&&&&&&&&&&&&&&&&f&&&&&&&f        @@@@@@@rK   r  AsyncSession._request_once  s    J ]]_$AQ ,B
,B
,B
 ,B
 f-	,B

 ]],B
 ,B
 ,B
 ,,0,B
 ,,0,B
 ,B
 "",B
 %,w$6DLLG,B
 )8(?$$_,B
" '4&;""#,B
& ,,0',B
( ),B
* "44T__+,B
, f--,B
. /,B
0 ,1,B
2 .3,B
4 $77t'7'75,B
6 txx7,B
8 ((T[[9,B
: "";,B
< ..=,B
@ )8(?$$_A,B
D E,B
F &::):):G,B
H  114>>I,B
J K,B
L *M,B
N  O,B
P ""Q,B
R **S,B
T  U,B
V  W,B
>V]A}hZ 6::((.D, , ,( "--gi8K))'2w}}m499;;; &&fm-=C ,A.M-)9::!!$'##CK*C#CLCI$$$$$&J(zz,,T2

 **&-1A? "(((((*!!$'_ %J <2  8**&-1A? ""1663q62CFAFFC0a78  !!$'s   QN7A QA'Q*.QQ0QQQ5,Q"Q9QAQ'BQ2N:3A:Q.Q N? !N="N? &?P+ %Q:Q=N? ?P(
AP##P((P+ +P>>Qc          F         V ^8  d   QhRRRRRRRRR	R
RRRRRRRRRRRRRRRRRRRRRRR RR!RR"R#R$R%R&RR'RR(RR)R*R+RR,R-R.R/R0R1R2RR3R4R5RR6R7R8R9R:R;R<R=/## r@  rB   )r   s   "rK   r   r  L  s    U/ U/U/ U/ 3	U/
 PU/ $U/ 'U/ 'U/ U/ (U/ EU/ @U/ %U/ %U/ U/  .!U/" #U/$ %U/& ''U/( -)U/* 2+U/, -U/. /U/0 1U/2 B3U/4 (5U/6 =7U/8 *9U/: K;U/< !=U/> 4?U/@ AU/B CU/D &EU/F GU/H 
IU/rJ   c#                Z  "   V P                  4        V P                  p#\        V#P                  ^,           4       F  p$ V P                  ! R$/ RVbRVbRVbRVbRVbRVbRVbRVbR	V	bR
V
bRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbRVbR V bR!V!bR"V"b G R#j  xL
 u # 	  R##  L
  \
         dY    T$T#P                  8X  d   h T P                  T$^,           4      p%T%'       d#   \        P                  ! T%4      G R#j  xL 
   K   K  i ; i5i)%zISend the request, see ``curl_cffi.requests.request`` for details on args.rn  r   r\   r   r   rP   rR   r   rT   r`   rc   re   rV   rX   rY   r^   r   r   r   rh   ri   rj   rk   rm   rn   rp   r   rt   rv   rx   r   r   r   r{   NrB   )	r/  rf   r  r   r  r#   r6  r  r  r  s&   &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&   rK   rr  AsyncSession.requestL  s    N 	""$::X^^a/0G*/!// #!## "# 	#
 # $# $#  # # $# %4# #0# $#  #  *#  "!#" $##$ %4%#& &6'#( !,)#* +#, "-#. /#0 &1#2 %43#4 &65#6  7#8 ".9#: (;#< =#> "?#@ $2A#B (C#D %4E# # # 1#H $ /hnn,))'A+6!--... 	/sM   <D+A9C8C9C<D+C<D(D(DD(!D+'D((D+c               $    V ^8  d   QhRRRRRR/# r  rB   )r   s   "rK   r   r    '     D Dc D-B Dq DrJ   c                	J   "   V P                   ! RR RRV/VB G Rj  xL
 #  L5i)rn  r  r   NrB   r  r  s   &&,rK   r  AsyncSession.head  '     \\CCSCFCCCC   #!#c               $    V ^8  d   QhRRRRRR/# r  rB   )r   s   "rK   r   r    '     C CS C,A Ca CrJ   c                	J   "   V P                   ! RR RRV/VB G Rj  xL
 #  L5i)rn  r  r   NrB   r  r  s   &&,rK   r   AsyncSession.get  '     \\BBCB6BBBBrX  c               $    V ^8  d   QhRRRRRR/# r  rB   )r   s   "rK   r   r    rT  rJ   c                	J   "   V P                   ! RR RRV/VB G Rj  xL
 #  L5i)rn  r  r   NrB   r  r  s   &&,rK   r  AsyncSession.post  rW  rX  c               $    V ^8  d   QhRRRRRR/# r  rB   )r   s   "rK   r   r    rZ  rJ   c                	J   "   V P                   ! RR RRV/VB G Rj  xL
 #  L5i)rn  r  r   NrB   r  r  s   &&,rK   r  AsyncSession.put  r]  rX  c               $    V ^8  d   QhRRRRRR/# r  rB   )r   s   "rK   r   r    '     E Es E.C E ErJ   c                	J   "   V P                   ! RR RRV/VB G Rj  xL
 #  L5i)rn  r  r   NrB   r  r  s   &&,rK   r  AsyncSession.patch  '     \\DDcDVDDDDrX  c               $    V ^8  d   QhRRRRRR/# r  rB   )r   s   "rK   r   r    s'     F F F/D F FrJ   c                	J   "   V P                   ! RR RRV/VB G Rj  xL
 #  L5i)rn  r  r   NrB   r  r  s   &&,rK   r  AsyncSession.delete  s'     \\EEsEfEEEErX  c               $    V ^8  d   QhRRRRRR/# r  rB   )r   s   "rK   r   r    s'     G G G0E G! GrJ   c                	J   "   V P                   ! RR RRV/VB G Rj  xL
 #  L5i)rn  r  r   NrB   r  r  s   &&,rK   r  AsyncSession.options  s'     \\FFFvFFFFrX  c               $    V ^8  d   QhRRRRRR/# r  rB   )r   s   "rK   r   r    re  rJ   c                	J   "   V P                   ! RR RRV/VB G Rj  xL
 #  L5i)rn  r  r   NrB   r  r  s   &&,rK   r  AsyncSession.trace  rh  rX  c               $    V ^8  d   QhRRRRRR/# r  rB   )r   s   "rK   r   r    re  rJ   c                	J   "   V P                   ! RR RRV/VB G Rj  xL
 #  L5i)rn  r  r   NrB   r  r  s   &&,rK   r  AsyncSession.query  rh  rX  )r  r   r  r  r  i  @ )!rD   rE   rF   rG   r>  r   r?  r  r   r  r
  r  r  r  re  r   r   r   r-   r  r  rr  r  r   r  r  r  r  r  r  r  rI   r  r  s   @rK   r  r  b  s   KE 26E (,	E
 E EN    
'
    OS&*&*'+CJ:>$($( -1""&915!;?'+&(DH $-1!!#% %26!&!& /$)-26M6J 6:RV&*)-)- $*.GNBF'+'+#04!%!%)</348! $"DH*.?F,.MQ#'6:!%(, %GT(t 6:RV&*)-)- $*.GNBF'+'+#04!%!%)</348! $"DH*.?F,.MQ#'6:!%(, %GU/nDCDCEFGEE ErJ   r  )      )r  r  )	r  r  r  r  r  r  r  r  r  r   r   )f
__future__r   r  http.cookiesr>   r   r   r4  sysrN  r  rW  collections.abcr   r   r   concurrent.futuresr   
contextlibr   r	   r
   dataclassesr   datetimer   ior   typingr   r   r   r   r   r   r   r   urllib.parser   aior   constr   r   r   r   r   r   r   r   utilsr   rR   r    r!   r"   
exceptionsr#   r$   r%   rP   r&   r'   rh   r(   r)   r*   modelsr+   r,   r-   r.   r/   r0   
websocketsr1   r2   r3   r4   r5   version_infor6   typing_extensionsr9   r;   rN   r~   r   r   dictr<   
ThreadTypero  r   r   r   r   r   r   r   rB  r  rB   rJ   rK   <module>r     s   "   	   
    ? ? 1 D D !  	 	 	 "  B B , , # 5 5 C C ) K K ( L L  w8X6A8$A(IU GAJ	 @iu B+5 
 
 YFS#XI!)2I&)*
P

; ./ % % %(G)'!* G)TK?k!n K?\Z	E;q> Z	ErJ   