
    vKg-%                         S SK r S SKrS SKrS SKJr  S SKJrJrJrJ	r	J
r
JrJr  SSKJr  SSKJr  SSKJrJr  SS	KJr   S S
KJr  \R4                  " S5      rS\ R8                  4S jr " S S5      r " S S5      rg! \ a	    S S
KJr   NFf = f)    N)Future)Any	AwaitableCallableDictListOptionalUnion   )Curl   )Cookies)	HTTPErrorRequestException)Headers)loadszcharset=([\w-]+)qc                     U R                      U R                  R                  5         U R                  R	                  5         SU l        S S S 5        g ! , (       d  f       g = f)Nr   )mutexqueueclearall_tasks_done
notify_allunfinished_tasks)r   s    Y/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/curl_cffi/requests/models.pyclear_queuer      s:    	
		##% 
s   <A
A c                   .    \ rS rSrSrS\S\S\4S jrSrg)	Request   zRepresenting a sent request.urlheadersmethodc                 (    Xl         X l        X0l        g )N)r    r!   r"   )selfr    r!   r"   s       r   __init__Request.__init__   s        )r!   r"   r    N)	__name__
__module____qualname____firstlineno____doc__strr   r%   __static_attributes__ r'   r   r   r      s    &C ' 3 r'   r   c                   L   \ rS rSrSrSS\\   S\\   4S jjr\	S\
4S j5       r\	S\
4S	 j5       r\R                  S
\
SS4S j5       r\	S\\
   4S j5       r\	S\
4S j5       rS\S\
4S jrS rSS jrSS jrS rS rSS jrSS jrS\
4S jrS\4S jrS rS\
4S jrSrg)Response%   a  Contains information the server sends.

Attributes:
    url: url used in the request.
    content: response body in bytes.
    text: response body in str.
    status_code: http status code.
    reason: http response reason, such as OK, Not Found.
    ok: is status_code in [200, 400)?
    headers: response headers.
    cookies: response cookies.
    elapsed: how many seconds the request cost.
    encoding: http body encoding.
    charset: alias for encoding.
    primary_ip: primary ip of the server.
    local_ip: local ip used in this connection.
    charset_encoding: encoding specified by the Content-Type header.
    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.
    redirect_count: how many redirects happened.
    redirect_url: the final redirected url.
    http_version: http version used.
    history: history redirections, only headers are available.
Ncurlrequestc                 T   Xl         X l        SU l        SU l        SU l        SU l        SU l        [        5       U l        [        5       U l
        SU l        SU l        SU l        SU l        SU l        SU l        SU l        / U l        0 U l        S U l        S U l        S U l        S U l        g )	N r'      OKTg        utf-8r   )r3   r4   r    contentstatus_codereasonokr   r!   r   cookieselapseddefault_encodingredirect_countredirect_urlhttp_version
primary_iplocal_iphistoryinfosr   stream_taskastream_taskquit_now)r$   r3   r4   s      r   r%   Response.__init__?   s    	yyDK!-/%'
,0
-115r'   returnc                     U R                   $ )zAlias for encoding.)encodingr$   s    r   charsetResponse.charsetW   s     }}r'   c                 <   [        U S5      (       d  U R                  nUca  [        U R                  [        5      (       a  U R                  nO5[        U R                  5      (       a  U R                  U R                  5      nU=(       d    SU l        U R                  $ )a  
Determines the encoding to decode byte content into text.

The method follows a specific priority to decide the encoding:
1. If `.encoding` has been explicitly set, it is used.
2. The encoding specified by the `charset` parameter in the `Content-Type` header.
3. The encoding specified by the `default_encoding` attribute. This can either be
   a string (e.g., "utf-8") or a callable for charset autodetection.
	_encodingr9   )hasattrcharset_encoding
isinstancer@   r-   callabler:   rS   )r$   rN   s     r   rN   Response.encoding\   s{     t[)),,Hd33S99#44Hd3344#44T\\BH%0DN~~r'   valuec                 H    [        U S5      (       a  [        S5      eXl        g )N_textz0Cannot set encoding after text has been accessed)rT   
ValueErrorrS   )r$   rY   s     r   rN   rX   q   s     4!!OPPr'   c                     U R                   R                  S5      nU(       a/  [        R                  U5      nU(       a  UR	                  S5      $ S$ g)z=Return the encoding, as specified by the Content-Type header.zContent-Typer   N)r!   get
CHARSET_REsearchgroup)r$   content_typecharset_matchs      r   rU   Response.charset_encodingw   sF     ||''7&--l;M-:=&&q)DDr'   c                     [        U S5      (       dD  U R                  (       d  SU l        U R                  $ U R                  U R                  5      U l        U R                  $ )Nr[   r6   )rT   r:   r[   _decoderO   s    r   textResponse.text   sI    tW%%<<
 zz "\\$,,7
zzr'   r:   c                      UR                  U R                  SS9$ ! [        [        4 a    UR                  S5      s $ f = f)Nreplace)errorsz	utf-8-sig)decoderN   UnicodeDecodeErrorLookupError)r$   r:   s     r   rf   Response._decode   sA    	/>>$--	>BB"K0 	/>>+..	/s    !A A c                 p    U R                   (       d%  [        SU R                   SU R                   35      eg)z2Raise an error if status code is not in [200, 400)zHTTP Error z: N)r=   r   r;   r<   rO   s    r   raise_for_statusResponse.raise_for_status   s1    wwk$*:*:);2dkk]KLL r'   c              #   4  #    SnU R                  XS9 Hu  nUb  XE-   nU(       a  UR                  U5      OUR                  5       nU(       a0  US   (       a&  U(       a  US   S   US   :X  a  UR                  5       OSnU Sh  vN   Mw     Ub  Uv   gg N7fz
iterate streaming content line by line, separated by ``\n``.

Copied from: https://requests.readthedocs.io/en/latest/_modules/requests/models/
which is under the License: Apache 2.0
N)
chunk_sizedecode_unicode)iter_contentsplit
splitlinespop)r$   ru   rv   	delimiterpendingchunkliness          r   
iter_linesResponse.iter_lines   s      &&*&\E".7EKK	*U=M=M=OE U2Y5U2Yr]eBi5O 		   ] M  s   BBBBc              #     #    U(       a  [         R                  " SSS9  U(       a
  [        5       eU R                  (       a  U R                  (       d   S5       e U R                  R                  5       n[        U[        5      (       a  U R                  R                  5         UeUc  U R                  R                  5         gUv   Mo  7fz4
iterate streaming content chunk by chunk in bytes.
z9chunk_size is ignored, there is no way to tell curl that.r   )
stacklevelzstream mode is not enabled.N)	warningswarnNotImplementedErrorr   r3   r^   rV   r   resetr$   ru   rv   r~   s       r   rx   Response.iter_content   s      MMUbcd%''zzdiiF)FF'JJNN$E %!122		! }		!K s   CC	c                 .    [        U R                  40 UD6$ )z+return a parsed json object of the content.)r   r:   )r$   kws     r   jsonResponse.json   s    T\\(R((r'   c                     U R                   (       a  U R                   R                  5         U R                  (       a  U R                  R                  5         ggz:Close the streaming connection, only valid in stream mode.N)rJ   setrH   resultrO   s    r   closeResponse.close   s;     ==MM##% r'   c                H  #    SnU R                  XS9  Sh  vN nUb  XE-   nU(       a  UR                  U5      OUR                  5       nU(       a0  US   (       a&  U(       a  US   S   US   :X  a  UR                  5       OSnU H  nU7v   M
     M   N|
 Ub  U7v   gg7frt   )aiter_contentry   rz   r{   )r$   ru   rv   r|   r}   r~   r   lines           r   aiter_linesResponse.aiter_lines   s      ---c 	%".7EKK	*U=M=M=OE U2Y5U2Yr]eBi5O 		  
 	c M s&   B"BBBA9B"BB"c                  #    U(       a  [         R                  " SSS9  U(       a
  [        5       eU R                  (       a  U R                  (       d   S5       e U R                  R                  5       I Sh  vN n[        U[        5      (       a  U R                  5       I Sh  vN   UeUc  U R                  5       I Sh  vN   gU7v   Mt   NV N+ N7fr   )	r   r   r   r   r3   r^   rV   r   acloser   s       r   r   Response.aiter_content   s      MMUbcd%''zzdiiF)FF'**..**E %!122kkm## }kkm##K * $
 $s6   A5C7C8,C$C%CCCCCc                 \   #    U R                  U R                  5       I Sh  vN 5      $  N7f)z
Return a decoded string.
N)rf   acontentrO   s    r   atextResponse.atext  s"      ||$--/1221s   ,*	,c                    #    / nU R                  5         Sh  vN nUR                  U5        M   N
 SR                  U5      $ 7f)z8wait and read the streaming content in one bytes object.Nr'   )r   appendjoin)r$   chunksr~   s      r   r   Response.acontent  s@     --/ 	!%MM% 	!/xxs   A313A3Ac                 \   #    U R                   (       a  U R                   I Sh  vN   gg N7fr   )rI   rO   s    r   r   Response.aclose  s'      #### #s   !,*,c                 "    SU R                    S3$ )Nz<Response [z]>)r;   rO   s    r   __repr__Response.__repr__  s    T--.b11r'   )rS   r[   rI   r:   r>   r3   r@   r?   r!   rF   rC   rG   rE   r=   rD   r   rJ   r<   rA   rB   r4   r;   rH   r    )NN)NFN)NF)r(   r)   r*   r+   r,   r	   r   r   r%   propertyr-   rP   rN   setterrU   rg   bytesrf   rq   r   rx   r   r   r   r   r   r   r   r   r.   r/   r'   r   r1   r1   %   s   2Xd^ Xg=N 0    #  ( __c d  
 (3-   c  /u / /M
04)&243S 3   $2# 2r'   r1   ) r   rer   concurrent.futuresr   typingr   r   r   r   r   r	   r
   r6   r   r>   r   
exceptionsr   r   r!   r   orjsonr   ImportErrorr   compiler_   Queuer   r   r1   r/   r'   r   <module>r      sy     	  % H H H   3  ZZ+,
5;;  v2 v2-  s    A> >BB