
    ,hD                       d dl mZ d dlZd dlZd dlZd dlZej                  ee	f   Z
ej                  ej                  e
e
f      Zej                  e
e
f   Zej                  eedf   Zej"                  e	ej$                  f   ZddZddZ	 d	 	 	 	 	 ddZ	 	 	 	 	 	 ddZdd	d
d	d
dZ	 	 	 	 	 	 	 	 ddZ G d d      Z G d d      Z G d d      Z G d d      Z G d d      Z G d d      Zy)    )annotationsNc                   t        | t              r	 | j                  d      S t        | t
              r| S t        |       j                  }t	        | d| d      # t        $ r t	        | d      w xY w)aX  
    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      R/var/www/html/Resume-Scraper/venv/lib/python3.12/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 A3URLc                   t        | t        t        f      rt        |       S t        | t              r| S t	        |       j
                  }t        | d| d      )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   (   sS     %%&5z	E3	U$$I
tfCI;aP
QQ    c          	        | g S t        | t        j                        r;| j                         D cg c]  \  }}t	        |d      t	        |d      f! c}}S t        | t        j
                        r-| D cg c]  \  }}t	        |d      t	        |d      f! c}}S t        |       j                  }t        | d| d      c c}}w c c}}w )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>>	* 

 1 am4an5
 	
 
E6??	+ 

 1 am4an5
 	
 U$$I
&FykQRS #

s   $C9$Cc               V    | t        d      S t        | t              rt        |       S | S )Nr   )
ByteStreamr   r   )r   r   s     r   enforce_streamr$   U   s-    
 }#	E5	!%  Lr      P     )s   ftp   http   https   ws   wssc                  t        d | D              }d|vrjt        j                  |j                        }|j                  |j                  |k(  r|j
                  }nd|j
                  |j                  fz  }d|fg| z   } |Kd|vrGd|vrCt        |t              r-t        t        |            j                  d      }| d|fgz  } | S | d	gz  } | S )
Nc              3  B   K   | ]  \  }}|j                           y wN)lower).0r   r    s      r   	<genexpr>z*include_request_headers.<locals>.<genexpr>s   s     4DAqaggi4s   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_headersr@   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                  0    e Zd ZdZddZddZd	dZd
dZy)r#   zl
    A container for non-streaming content, and that supports both sync and async
    stream iteration.
    c                    || _         y r.   _content)selfr;   s     r   __init__zByteStream.__init__   s	    r   c              #  (   K   | j                    y wr.   rC   rE   s    r   __iter__zByteStream.__iter__   s     mms   c               *   K   | j                    y wr.   rC   rH   s    r   	__aiter__zByteStream.__aiter__   s     mms   c                b    d| j                   j                   dt        | j                         dS )N< [z bytes]>)	__class__r   r8   rD   rH   s    r   __repr__zByteStream.__repr__   s,    4>>**+2c$--.@-AJJr   N)r;   r   returnNonerQ   ztyping.Iterator[bytes]rQ   ztyping.AsyncIterator[bytes]rQ   r   )r   
__module____qualname____doc__rF   rI   rK   rP    r   r   r#   r#      s    
 Kr   r#   c                  $    e Zd ZddZddZddZy)Originc                .    || _         || _        || _        y r.   r5   r7   r6   rE   r5   r7   r6   s       r   rF   zOrigin.__init__   s    		r   c                    t        |t              xrO | j                  |j                  k(  xr4 | j                  |j                  k(  xr | j                  |j                  k(  S r.   )r   r[   r5   r7   r6   rE   others     r   __eq__zOrigin.__eq__   sR    uf% (u||+(		UZZ'( 		UZZ'		
r   c                    | j                   j                  d      }| j                  j                  d      }t        | j                        }| d| d| S )Nr   z://:)r5   decoder7   r   r6   r^   s       r   __str__zOrigin.__str__   sN    ##G,yy(499~TF!D6**r   N)r5   r   r7   r   r6   intrQ   rR   ra   z
typing.AnyrQ   boolrU   )r   rV   rW   rF   rb   rf   rY   r   r   r[   r[      s    

+r   r[   c                  h    e Zd ZdZ	 d
ddddd	 	 	 	 	 	 	 	 	 	 	 ddZedd       ZddZddZdd	Z	y)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r5   r7   r6   targetc                  |rt         j                  j                  t        |d            }|j                  | _        |j
                  xs d| _        |j                  | _        |j                  xs d|j                  rd|j                  z   z   | _
        y	dz   | _
        y	t        |d      | _        t        |d      | _        || _        t        |d      | _
        y	)
a  
        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      /   ?r5   r7   rl   N)urllibparseurlparser   r5   hostnamer7   r6   pathqueryrl   )rE   r:   r5   r7   r6   rl   parseds          r   rF   zURL.__init__   s    $ \\**=5+IJF --DK.3DIDI!;;.$'-||v||#DK9<DK (X>DK%d8DIDI'X>DKr   c                    ddddddd| j                      }t        | j                   | j                  | j                  xs |      S )Nr&   r'   i8  )r(   r)   r*   r+   s   socks5s   socks5hr]   )r5   r[   r7   r6   )rE   r=   s     r   originz
URL.origin  sR     
 ++ ;;TYYTYY5N,
 	
r   c                    t        |t              xrj |j                  | j                  k(  xrO |j                  | j                  k(  xr4 |j                  | j                  k(  xr |j
                  | j
                  k(  S r.   )r   r   r5   r7   r6   rl   r`   s     r   rb   z
URL.__eq__'  si    uc" ,+,

dii', 

dii', +	
r   c                    | j                   &d| j                  | j                  | j                  fz  S d| j                  | j                  | j                   | j                  fz  S )Ns	   %b://%b%bs   %b://%b:%d%b)r6   r5   r7   rl   rH   s    r   	__bytes__zURL.__bytes__0  sN    994;;		4;;"GGG$++tyy$))T[[!QQQr   c           
         | j                   j                   d| j                  d| j                  d| j                  d| j
                  d
S )Nz(scheme=z, host=z, port=z	, target=))rO   r   r5   r7   r6   rl   rH   s    r   rP   zURL.__repr__5  sK    ~~&&'x ?II=		}Idkk_AO	
r   ) )r:   bytes | strr5   r   r7   r   r6   z
int | Nonerl   r   rQ   rR   )rQ   r[   rh   rQ   r   rU   )
r   rV   rW   rX   rF   propertyrx   rb   r{   rP   rY   r   r   r   r      s    @H ? "!?? 	?
 ? ? ? 
?@ 
 

R

r   c                  @    e Zd ZdZdddd	 	 	 	 	 	 	 	 	 	 	 ddZddZy)Requestz
    An HTTP request.
    Nr9   r;   
extensionsc                  t        |d      | _        t        |d      | _        t	        |d      | _        t        |d      | _        |i n|| _        d| j                  v r^t        | j                  j                  | j                  j                  | j                  j                  | j                  d         | _        yy)	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:   r9   r;   Nrl   rk   )r   r   r   r:   r!   r9   r$   streamr   r   r5   r7   r6   )rE   r   r:   r9   r;   r   s         r   rF   zRequest.__init__A  s    . +6A#Ce42A)3
 73 	 !+ 2"
t&xxXX]]XX]]x0	DH 'r   c                P    d| j                   j                   d| j                  dS NrM   rN   z]>)rO   r   r   rH   s    r   rP   zRequest.__repr__j  s&    4>>**+2dkk_B??r   )r   r   r:   URL | bytes | strr9   HeaderTypesr;   Cbytes | typing.Iterable[bytes] | typing.AsyncIterable[bytes] | Noner   Extensions | NonerQ   rR   rU   )r   rV   rW   rX   rF   rP   rY   r   r   r   r   <  sZ      $ (,'' '
 '' &' 
'R@r   r   c                  ~    e Zd ZdZdddd	 	 	 	 	 	 	 	 	 ddZedd       ZddZddZddZ	dd	Z
dd
ZddZddZy)Responsez
    An HTTP response.
    Nr   c               ~    || _         t        |d      | _        t        |d      | _        |i n|| _        d| _        y)a  
        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"`.
        r9   r   r;   NF)statusr!   r9   r$   r   r   _stream_consumed)rE   r   r9   r;   r   s        r   rF   zResponse.__init__s  sG    ( "2A)3
 73 	 !+ 2"
 %r   c                    t        | d      s:t        | j                  t        j                        rt        d      t        d      | j                  S )NrD   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RuntimeErrorrD   rH   s    r   r;   zResponse.content  sP    tZ($++v7"4 
 #;  }}r   c                P    d| j                   j                   d| j                   dS r   )rO   r   r   rH   s    r   rP   zResponse.__repr__  s&    4>>**+2dkk]"==r   c                    t        | j                  t        j                        st	        d      t        | d      s2dj                  | j                         D cg c]  }| c}      | _        | j                  S c c}w )NztAttempted to read an asynchronous response using 'response.read()'. You should use 'await response.aread()' instead.rD   r   )	r   r   r   r   r   r   joiniter_streamrD   rE   parts     r   readzResponse.read  sg    $++v7C  tZ(HHt7G7G7I%Jtd%JKDM}} &Ks   	A:c              #     K   t        | j                  t        j                        st	        d      | j
                  rt	        d      d| _        | j                  D ]  }|  y w)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   rE   chunks     r   r   zResponse.iter_stream  sh     $++v7U 
   W  !%[[ 	EK	s   A$A&c                    t        | j                  t        j                        st	        d      t        | j                  d      r| j                  j                          y y )NzwAttempted to close an asynchronous response using 'response.close()'. You should use 'await response.aclose()' instead.close)r   r   r   r   r   r   r   rH   s    r   r   zResponse.close  sL    $++v7D  4;;(KK )r   c                  K   t        | j                  t        j                        st	        d      t        | d      s+dj                  | j                         2 cg c3 d {   }|| j                  S 7 6 nc c}w c}      | _        "w)NzsAttempted to read an synchronous response using 'await response.aread()'. You should use 'response.read()' instead.rD   r   )	r   r   r   AsyncIterabler   r   r   aiter_streamrD   r   s     r   areadzResponse.aread  ss     $++v';';<< 
 tZ(HHT=N=N=P%Q%QTd}} &R%Q%QRDMs<   ABA9A7
!A5"A7
%A9)B5A7
7A98Bc                  K   t        | j                  t        j                        st	        d      | j
                  rt	        d      d| _        | j                  2 3 d {   }| 7 
6 y w)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   zResponse.aiter_stream  st     $++v';';<N 
   "  !%;; 	 	%K	;s*   AA/A- A+!A-$A/+A--A/c                   K   t        | j                  t        j                        st	        d      t        | j                  d      r#| j                  j                          d {    y y 7 w)NzuAttempted to close a synchronous response using 'await response.aclose()'. You should use 'response.close()' instead.aclose)r   r   r   r   r   r   r   rH   s    r   r   zResponse.aclose  sZ     $++v';';<= 
 4;;)++$$&&& *&s   A#A.%A,&A.)
r   rg   r9   r   r;   r   r   r   rQ   rR   r   rU   rS   )rQ   rR   rT   )r   rV   rW   rX   rF   r   r;   rP   r   r   r   r   r   r   rY   r   r   r   r   n  s      $ (,&& 	&
& && 
&>  >
 	 'r   r   c                  *    e Zd Z	 	 	 d	 	 	 	 	 	 	 ddZy)ProxyNc                .   t        |d      | _        t        |d      | _        || _        |at        |d   d      }t        |d   d      }|dz   |z   }dt        j                  |      z   }||f| _        d	|fg| j                  z   | _        y d | _        y )
Nr:   r   r9   r   auth      :s   Basic s   Proxy-Authorization)	r   r:   r!   r9   ssl_contextr   base64	b64encoder   )	rE   r:   r   r9   r   usernamepassworduserpassauthorizations	            r   rF   zProxy.__init__  s     s/&wY?&$T!W6:H$T!W6:H$1H%(8(8(BBM5=x4HDI3]CDt||SDLDIr   )NNN)r:   r   r   z&tuple[bytes | str, bytes | str] | Noner9   +HeadersAsMapping | HeadersAsSequence | Noner   zssl.SSLContext | None)r   rV   rW   rF   rY   r   r   r   r     s8     8<?C-1 5 =	
 +r   r   )r   r   r   r   rQ   r   )r   r   r   r   rQ   r   r.   )r   r   r   r   rQ   list[tuple[bytes, bytes]])r   r   r   r   rQ   z4typing.Iterable[bytes] | typing.AsyncIterable[bytes])r9   r   r:   z'URL'r;   zCNone | bytes | typing.Iterable[bytes] | typing.AsyncIterable[bytes]rQ   r   ) 
__future__r   r   sslr   urllib.parserp   Unionr   r   	ByteOrStrr   TupleHeadersAsSequencer   HeadersAsMappingr   MutableMappingAny
Extensionsr   r   r!   r$   r3   r@   r#   r[   r   r   r   r   rY   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   