
    hD                       S SK Jr  S SKrS SKrS SKrS SKr\R                  \\	4   r
\R                  \R                  \
\
4      r\R                  \
\
4   r\R                  \\S4   r\R"                  \	\R$                  4   rSS jrSS jr S     SS jjr      SS jrSS	S
S	S
S.r        SS jr " S S5      r " S S5      r " S S5      r " S S5      r " S S5      r " S S5      rg)    )annotationsNc                  [        U [        5      (       a   U R                  S5      $ [        U [
        5      (       a  U $ [        U 5      R                  n[	        U SU S35      e! [         a    [	        U S35      ef = f)a@  
Any arguments that are ultimately represented as bytes can be specified
either as bytes or as strings.

However we enforce that any string arguments must only contain characters in
the plain ASCII range. chr(0)...chr(127). If you need to use characters
outside that range then be precise, and use a byte-wise argument.
asciiz, strings may not include unicode characters.z must be bytes or str, but got .)
isinstancestrencodeUnicodeEncodeError	TypeErrorbytestype__name__valuename	seen_types      B/var/www/html/env/lib/python3.13/site-packages/httpcore/_models.pyenforce_bytesr      s     %	S<<(( 
E5	!	!U$$I
tf;I;aH
II " 	Stf$PQRR	Ss   A% %A>URLc                   [        U [        [        45      (       a  [        U 5      $ [        U [        5      (       a  U $ [	        U 5      R
                  n[        U SU S35      e)z 
Type check for URL parameters.
z' must be a URL, bytes, or str, but got r   )r   r   r   r   r   r   r   r   s      r   enforce_urlr   (   sY     %%&&5z	E3		U$$I
tfCI;aP
QQ    c          
        U c  / $ [        U [        R                  5      (       a7  U R                  5        VVs/ s H  u  p#[	        USS9[	        USS94PM     snn$ [        U [        R
                  5      (       a)  U  VVs/ s H  u  p#[	        USS9[	        USS94PM     snn$ [        U 5      R                  n[        U SU S35      es  snnf s  snnf )z
Convienence function that ensure all items in request or response headers
are either bytes or strings in the plain ASCII range.
zheader namer   zheader valuez6 must be a mapping or sequence of two-tuples, but got r   )	r   typingMappingitemsr   Sequencer   r   r   )r   r   kvr   s        r   enforce_headersr!   5   s     }		E6>>	*	* 

 & am4an5 &
 	
 
E6??	+	+ 

  am4an5 
 	
 U$$I
&FykQRS #

s    C
  Cc               b    U c  [        S5      $ [        U [        5      (       a  [        U 5      $ U $ )Nr   )
ByteStreamr   r   )r   r   s     r   enforce_streamr$   U   s0    
 }#	E5	!	!%  Lr      P     )s   ftp   http   https   ws   wssc                  [        S U  5       5      nSU;  al  [        R                  UR                  5      nUR                  b  UR                  U:X  a  UR
                  nOSUR
                  UR                  4-  nSU4/U -   n UbT  SU;  aN  SU;  aH  [        U[        5      (       a-  [        [        U5      5      R                  S5      nU SU4/-  n U $ U S	/-  n U $ )
Nc              3  F   #    U  H  u  pUR                  5       v   M     g 7fN)lower).0r   r    s      r   	<genexpr>*include_request_headers.<locals>.<genexpr>s   s     4GDAaggiiGs   !s   hosts   %b:%ds   Hosts   content-lengths   transfer-encodingr   s   Content-Length)s   Transfer-Encodings   chunked)setDEFAULT_PORTSgetschemeporthostr   r   r   lenr	   )headersurlcontentheaders_setdefault_portheader_valuecontent_lengths          r   include_request_headersrA   m   s     4G44Kk!$((488sxx<788L#sxx&::L\*+g5 	[0 3gu%% W.55g>N*N;<<G N :;;GNr   c                  @    \ rS rSrSrS	S jrS
S jrSS jrSS jrSr	g)r#      z`
A container for non-streaming content, and that supports both sync and async
stream iteration.
c                    Xl         g r.   _content)selfr<   s     r   __init__ByteStream.__init__   s    r   c              #  (   #    U R                   v   g 7fr.   rE   rG   s    r   __iter__ByteStream.__iter__   s     mms   c               *   #    U R                   7v   g 7fr.   rE   rK   s    r   	__aiter__ByteStream.__aiter__   s     mms   c                b    SU R                   R                   S[        U R                  5       S3$ )N< [z bytes]>)	__class__r   r9   rF   rK   s    r   __repr__ByteStream.__repr__   s,    4>>**+2c$--.@-AJJr   rE   N)r<   r   returnNonerW   ztyping.Iterator[bytes]rW   ztyping.AsyncIterator[bytes]rW   r   )
r   
__module____qualname____firstlineno____doc__rH   rL   rO   rU   __static_attributes__ r   r   r#   r#      s    
 Kr   r#   c                  2    \ rS rSrSS jrSS jrS	S jrSrg)
Origin   c                (    Xl         X l        X0l        g r.   r6   r8   r7   rG   r6   r8   r7   s       r   rH   Origin.__init__   s    		r   c                    [        U[        5      =(       aY    U R                  UR                  :H  =(       a9    U R                  UR                  :H  =(       a    U R                  UR                  :H  $ r.   )r   rc   r6   r8   r7   rG   others     r   __eq__Origin.__eq__   sR    uf% (u||+(		UZZ'( 		UZZ'		
r   c                    U R                   R                  S5      nU R                  R                  S5      n[        U R                  5      nU SU SU 3$ )Nr   z://:)r6   decoder8   r   r7   rg   s       r   __str__Origin.__str__   sN    ##G,yy(499~TF!D6**r   )r8   r7   r6   N)r6   r   r8   r   r7   intrW   rX   rk   z
typing.AnyrW   boolr[   )r   r\   r]   r^   rH   rl   rq   r`   ra   r   r   rc   rc      s    

+r   rc   c                  ~    \ rS rSrSr SSSSSS.           SS jjjr\SS j5       rSS jrSS	 jr	SS
 jr
Srg)r      a  
Represents the URL against which an HTTP request may be made.

The URL may either be specified as a plain string, for convienence:

```python
url = httpcore.URL("https://www.example.com/")
```

Or be constructed with explicitily pre-parsed components:

```python
url = httpcore.URL(scheme=b'https', host=b'www.example.com', port=None, target=b'/')
```

Using this second more explicit style allows integrations that are using
`httpcore` to pass through URLs that have already been parsed in order to use
libraries such as `rfc-3986` rather than relying on the stdlib. It also ensures
that URL parsing is treated identically at both the networking level and at any
higher layers of abstraction.

The four components are important here, as they allow the URL to be precisely
specified in a pre-parsed format. They also allow certain types of request to
be created that could not otherwise be expressed.

For example, an HTTP request to `http://www.example.com/` forwarded via a proxy
at `http://localhost:8080`...

```python
# Constructs an HTTP request with a complete URL as the target:
# GET https://www.example.com/ HTTP/1.1
url = httpcore.URL(
    scheme=b'http',
    host=b'localhost',
    port=8080,
    target=b'https://www.example.com/'
)
request = httpcore.Request(
    method="GET",
    url=url
)
```

Another example is constructing an `OPTIONS *` request...

```python
# Constructs an 'OPTIONS *' HTTP request:
# OPTIONS * HTTP/1.1
url = httpcore.URL(scheme=b'https', host=b'www.example.com', target=b'*')
request = httpcore.Request(method="OPTIONS", url=url)
```

This kind of request is not possible to formulate with a URL string,
because the `/` delimiter is always used to demark the target from the
host/port portion of the URL.

For convenience, string-like arguments may be specified either as strings or
as bytes. However, once a request is being issue over-the-wire, the URL
components are always ultimately required to be a bytewise representation.

In order to avoid any ambiguity over character encodings, when strings are used
as arguments, they must be strictly limited to the ASCII range `chr(0)`-`chr(127)`.
If you require a bytewise representation that is outside this range you must
handle the character encoding directly, and pass a bytes instance.
r   Nr6   r8   r7   targetc                  U(       a  [         R                  R                  [        USS95      nUR                  U l        UR
                  =(       d    SU l        UR                  U l        UR                  =(       d    SUR                  (       a  SUR                  -   OS-   U l
        g	[        USS9U l        [        USS9U l        X@l        [        USS9U l
        g	)
ar  
Parameters:
    url: The complete URL as a string or bytes.
    scheme: The URL scheme as a string or bytes.
        Typically either `"http"` or `"https"`.
    host: The URL host as a string or bytes. Such as `"www.example.com"`.
    port: The port to connect to. Either an integer or `None`.
    target: The target of the HTTP request. Such as `"/items?search=red"`.
r;   r   r      /   ?r6   r8   ry   N)urllibparseurlparser   r6   hostnamer8   r7   pathqueryry   )rG   r;   r6   r8   r7   ry   parseds          r   rH   URL.__init__   s    $ \\**=5+IJF --DK.3DIDI!;;.$'-||v||#DK (X>DK%d8DII'X>DKr   c                    SSSSSSS.U R                      n[        U R                   U R                  U R                  =(       d    US9$ )Nr&   r'   i8  )r(   r)   r*   r+   s   socks5s   socks5hrf   )r6   rc   r8   r7   )rG   r>   s     r   origin
URL.origin  sR     
 ++ ;;TYYTYY5N,
 	
r   c                "   [        U[        5      =(       ay    UR                  U R                  :H  =(       aY    UR                  U R                  :H  =(       a9    UR                  U R                  :H  =(       a    UR
                  U R
                  :H  $ r.   )r   r   r6   r8   r7   ry   rj   s     r   rl   
URL.__eq__'  si    uc" ,+,

dii', 

dii', +	
r   c                    U R                   c&  SU R                  U R                  U R                  4-  $ SU R                  U R                  U R                   U R                  4-  $ )Ns	   %b://%b%bs   %b://%b:%d%b)r7   r6   r8   ry   rK   s    r   	__bytes__URL.__bytes__0  sN    994;;		4;;"GGG$++tyy$))T[[!QQQr   c           
         U R                   R                   SU R                  < SU R                  < SU R                  < SU R
                  < S3
$ )Nz(scheme=z, host=z, port=z	, target=))rT   r   r6   r8   r7   ry   rK   s    r   rU   URL.__repr__5  sK    ~~&&'x ?II=		}Idkk_AO	
r   )r8   r7   r6   ry   ) )r;   bytes | strr6   r   r8   r   r7   z
int | Nonery   r   rW   rX   )rW   rc   rt   rW   r   r[   )r   r\   r]   r^   r_   rH   propertyr   rl   r   rU   r`   ra   r   r   r   r      s    @H ? "!?? 	?
 ? ? ? 
?@ 
 

R

r   c                  N    \ rS rSrSrSSSS.           SS jjrS	S jrSrg)
Requesti<  z
An HTTP request.
Nr:   r<   
extensionsc               j   [        USS9U l        [        USS9U l        [	        USS9U l        [        USS9U l        Uc  0 OUU l        SU R                  ;   a[  [        U R                  R                  U R                  R                  U R                  R                  U R                  S   S9U l        gg)	a  
Parameters:
    method: The HTTP request method, either as a string or bytes.
        For example: `GET`.
    url: The request URL, either as a `URL` instance, or as a string or bytes.
        For example: `"https://www.example.com".`
    headers: The HTTP request headers.
    content: The content of the request body.
    extensions: A dictionary of optional extra information included on
        the request. Possible keys include `"timeout"`, and `"trace"`.
methodr   r;   r:   r<   Nry   rx   )r   r   r   r;   r!   r:   r$   streamr   r   r6   r8   r7   )rG   r   r;   r:   r<   r   s         r   rH   Request.__init__A  s    . +6A#Ce42A)3
 73 	 !+ 2"
t&xxXX]]XX]]x0	DH 'r   c                R    SU R                   R                   SU R                  < S3$ NrR   rS   z]>)rT   r   r   rK   s    r   rU   Request.__repr__j  s&    4>>**+2dkk_B??r   )r   r:   r   r   r;   )r   r   r;   URL | bytes | strr:   HeaderTypesr<   Cbytes | typing.Iterable[bytes] | typing.AsyncIterable[bytes] | Noner   Extensions | NonerW   rX   r[   )r   r\   r]   r^   r_   rH   rU   r`   ra   r   r   r   r   <  sZ      $ (,'' '
 '' &' 
'R@r   r   c                      \ rS rSrSrSSSS.         SS jjr\SS j5       rSS jrSS jr	SS	 jr
SS
 jrSS jrSS jrSS jrSrg)Responsein  z
An HTTP response.
Nr   c               r    Xl         [        USS9U l        [        USS9U l        Uc  0 OUU l        SU l        g)ad  
Parameters:
    status: The HTTP status code of the response. For example `200`.
    headers: The HTTP response headers.
    content: The content of the response body.
    extensions: A dictionary of optional extra information included on
        the responseself.Possible keys include `"http_version"`,
        `"reason_phrase"`, and `"network_stream"`.
r:   r   r<   NF)statusr!   r:   r$   r   r   _stream_consumed)rG   r   r:   r<   r   s        r   rH   Response.__init__s  sE    ( "2A)3
 73 	 !+ 2"
 %r   c                    [        U S5      (       d?  [        U R                  [        R                  5      (       a  [        S5      e[        S5      eU R                  $ )NrF   z]Attempted to access 'response.content' on a streaming response. Call 'response.read()' first.zdAttempted to access 'response.content' on a streaming response. Call 'await response.aread()' first.)hasattrr   r   r   IterableRuntimeErrorrF   rK   s    r   r<   Response.content  sV    tZ(($++v77"4 
 #;  }}r   c                P    SU R                   R                   SU R                   S3$ r   )rT   r   r   rK   s    r   rU   Response.__repr__  s&    4>>**+2dkk]"==r   c                   [        U R                  [        R                  5      (       d  [	        S5      e[        U S5      (       d4  SR                  U R                  5        Vs/ s H  oPM     sn5      U l        U R                  $ s  snf )NztAttempted to read an asynchronous response using 'response.read()'. You should use 'await response.aread()' instead.rF   r   )	r   r   r   r   r   r   joiniter_streamrF   rG   parts     r   readResponse.read  ss    $++v77C  tZ((HHt7G7G7I%J7Itd7I%JKDM}} &Ks   #Bc              #     #    [        U R                  [        R                  5      (       d  [	        S5      eU R
                  (       a  [	        S5      eSU l        U R                   H  nUv   M	     g 7f)NzAttempted to stream an asynchronous response using 'for ... in response.iter_stream()'. You should use 'async for ... in response.aiter_stream()' instead.zEAttempted to call 'for ... in response.iter_stream()' more than once.T)r   r   r   r   r   r   rG   chunks     r   r   Response.iter_stream  se     $++v77U 
   W  !%[[EK !s   A0A2c                    [        U R                  [        R                  5      (       d  [	        S5      e[        U R                  S5      (       a  U R                  R                  5         g g )NzwAttempted to close an asynchronous response using 'response.close()'. You should use 'await response.aclose()' instead.close)r   r   r   r   r   r   r   rK   s    r   r   Response.close  sR    $++v77D  4;;((KK )r   c                .  #    [        U R                  [        R                  5      (       d  [	        S5      e[        U S5      (       d+  SR                  U R                  5        Vs/ s S h  vN oPM  U R                  $  N
 Os  snf sn5      U l        N"7f)NzsAttempted to read an synchronous response using 'await response.aread()'. You should use 'response.read()' instead.rF   r   )	r   r   r   AsyncIterabler   r   r   aiter_streamrF   r   s     r   areadResponse.aread  st     $++v';';<<< 
 tZ((HHT=N=N=P%Q%QTd}} &R%QRDMs<   A#B%B'B
+A?,B
/B3B?B
BBc                  #    [        U R                  [        R                  5      (       d  [	        S5      eU R
                  (       a  [	        S5      eSU l        U R                    S h  vN nU7v   M   N
 g 7f)NzAttempted to stream an synchronous response using 'async for ... in response.aiter_stream()'. You should use 'for ... in response.iter_stream()' instead.zLAttempted to call 'async for ... in response.aiter_stream()' more than once.T)r   r   r   r   r   r   r   s     r   r   Response.aiter_stream  sp     $++v';';<<N 
   "  !%;; 	%K	;s*   A$A:&A8*A6+A8.A:6A88A:c                   #    [        U R                  [        R                  5      (       d  [	        S5      e[        U R                  S5      (       a#  U R                  R                  5       I S h  vN   g g  N7f)NzuAttempted to close a synchronous response using 'await response.aclose()'. You should use 'response.close()' instead.aclose)r   r   r   r   r   r   r   rK   s    r   r   Response.aclose  s_     $++v';';<<= 
 4;;))++$$&&& *&s   A-A8/A60A8)rF   r   r   r:   r   r   )
r   rs   r:   r   r<   r   r   r   rW   rX   r   r[   rY   )rW   rX   rZ   )r   r\   r]   r^   r_   rH   r   r<   rU   r   r   r   r   r   r   r`   ra   r   r   r   r   n  s      $ (,&& 	&
& && 
&>  >
 	 'r   r   c                  6    \ rS rSr   S       SS jjrSrg)Proxyi  Nc                   [        USS9U l        [        USS9U l        X@l        Ub[  [        US   SS9n[        US   SS9nUS-   U-   nS[        R                  " U5      -   nXV4U l        S	U4/U R                  -   U l        g S U l        g )
Nr;   r   r:   r   auth      :s   Basic s   Proxy-Authorization)	r   r;   r!   r:   ssl_contextr   base64	b64encoder   )	rG   r;   r   r:   r   usernamepassworduserpassauthorizations	            r   rH   Proxy.__init__  s     s/&wY?&$T!W6:H$T!W6:H$1H%(8(8(BBM5=4HDI3]CDt||SDLDIr   )r   r:   r   r;   )NNN)r;   r   r   z&tuple[bytes | str, bytes | str] | Noner:   +HeadersAsMapping | HeadersAsSequence | Noner   zssl.SSLContext | None)r   r\   r]   r^   rH   r`   ra   r   r   r   r     s=     8<?C-1 5 =	
 + r   r   )r   r   r   r   rW   r   )r   r   r   r   rW   r   r.   )r   r   r   r   rW   list[tuple[bytes, bytes]])r   r   r   r   rW   z4typing.Iterable[bytes] | typing.AsyncIterable[bytes])r:   r   r;   z'URL'r<   zCNone | bytes | typing.Iterable[bytes] | typing.AsyncIterable[bytes]rW   r   ) 
__future__r   r   sslr   urllib.parser}   Unionr   r   	ByteOrStrr   TupleHeadersAsSequencer   HeadersAsMappingr   MutableMappingAny
Extensionsr   r   r!   r$   r4   rA   r#   rc   r   r   r   r   ra   r   r   <module>r      sd   "  
  
 LL$	OOFLLI1E$FG >>)Y"67 ll,.>DE""3

?3
J*
R :>6HK@	N	 	 :		  & 
 Q	
 BK K&+ +*C
 C
L/@ /@d' 'D r   