+
     h  c            	       s   R 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
t
^ RIt^ RIHt ^ RI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HtHtHtHtHtH t  ^RIH!t" ^R	IH#t#H$t$H%t%H&t&H't'H(t(H)t) ^R
I*H+t+ ^RI,H-t-H.t.H/t/H0t0 ^RI1H2t2 REt3]Ph                  ! 4       t5R^PRR/t6RPo                  ]Pp                  ! R]! RR7      R,          4      4      t9]Pt                  R8X  d   R t;R t#R t<R t=RFR lt>R t?R t@]P                  R 4       tBR tCR tDR  tER! tFRFR" ltGR# tHR$ tIR% tJR& tKR' tLR( tMR) tNR* tO]P! RG4      tQR+ tRR, tSRHR- ltTR. tUR/ tVR0 tWR1 tXR2 tYR3 tZ]P                  R4 4       t[R5 t\RIR6 lt]R7 t^RJR8 lt_RKR9 lt`R: taR; tbR<P                  R=4      td]d^,          te]d^,          tfR> tgR? thR@ tiRA tjRB tkRC tlRD tmR# )Lz
requests.utils
~~~~~~~~~~~~~~

This module provides utility functions that are used within Requests
that are also useful for external consumption.
N)OrderedDict)make_headers	parse_url)certs__version__)_HEADER_VALIDATORS_BYTE_HEADER_VALIDATORS_STRHEADER_VALIDATORSto_native_string)Mapping
basestringbytes
getproxiesgetproxies_environmentinteger_typesis_urllib3_1)parse_http_list)proxy_bypassproxy_bypass_environmentquotestrunquoteurlparse
urlunparsecookiejar_from_dict)FileModeWarningInvalidHeader
InvalidURLUnrewindableBodyError)CaseInsensitiveDictZhttpZhttpsi  z, z,\s*T)Zaccept_encodingzaccept-encodingZwin32c                 sn    ^ RI p TP                  TP                  R4      p\	        TP                  TR4      ^ ,          4      pTP                  TR4      ^ ,          pT'       d	   T'       g   R# TP                  R4      p\        RT4      pT Fx  pTR8X  d   RT 9  d    R	# TP                  RR
4      pTP                  RR4      pTP                  RR4      p\        P                  ! YP\        P                  4      '       g   Kw   R	# 	  R#   \         d     R# i ; i  \        \        3 d     R# i ; i)    NFz;Software\Microsoft\Windows\CurrentVersion\Internet SettingsZProxyEnableZProxyOverride;z<local>Z.Tz\.Z*z.*Z?)winregImportErrorZOpenKeyZHKEY_CURRENT_USERintZQueryValueExOSError
ValueErrorsplitZfilterreplacerematchI)hostr"   ZinternetSettingsZproxyEnableZproxyOverrideZtests   &     3/usr/lib/python3.14/site-packages/requests/utils.pyproxy_bypass_registryr.   M   s!   	
	%~~((N 
 f112BMRSTUVK"//0@/RSTUM -
 &++C0t]3!Dy d?<<U+D<<U+D<<T*DxxBDD)) " C  		 $ 		s#   D AD DDD43D4c                sN    \        4       '       d   \        V 4      # \        V 4      # )zReturn True, if the host should be bypassed.

Checks proxy settings gathered from the environment, if specified,
or the registry.
)r   r   r.   )r,      &r-   r   r   s   s#     "##+D11(..    c                sJ    \        V R4      '       d   V P                  4       p V # )z/Returns an internal sequence dictionary update.items)hasattrr1   )Zdr/   r-   dict_to_sequencer3      s!     q'GGIHr0   c                 s|   R p^ p\         '       g(   \        V \        4      '       d   V P                  R4      p \	        V R4      '       d   \        V 4      pM\	        V R4      '       d   V P
                  pMo\	        V R4      '       d^    V P                  4       p\        P                  ! V4      P                  pRV P                  9  d   \        P                  ! R\        4       \	        V R4      '       df    V P#                  4       p\	        V R4      '       dC   Vf?    V P%                  ^ ^4       V P#                  4       pT P%                  T;'       g    ^ 4       Vf   ^ p\)        ^ W,
          4      #   \        P                  \         3 d     Li ; i  \&         d    ^ p LHi ; i  \&         d
    Te   Tp L_i ; i)	Nutf-8Z__len__lenfilenoba%  Requests has determined the content-length for this request using the binary size of the file: however, the file has been opened in text mode (i.e. without the 'b' flag in the mode). This may lead to an incorrect content-length. In Requests 3.0, support will be removed for files in text mode.tellseek)r   
isinstancer   encoder2   r5   r6   osZfstatZst_sizeZmodewarningswarnr   ioZUnsupportedOperationAttributeErrorr8   r9   r%   Zmax)ZoZtotal_lengthZcurrent_positionr6      &   r-   	super_lenrB      s   L<Jq#.. HHWq)1v	E		uu	H			XXZF 88F+33L !&& 2 $
 q&	% vvx q&!!l&:	%FF1aL#$668L FF+00q1 q,122e ''8 	 		X  %#$L%%  	0
 '#/ 	0s<   E3 7F' 5F F 3FFF$#F$'F;:F;c                sR   \         P                  P                  R4      pVe   V3pMR \         4       p ^ RIHpHp RpV FK  p\         P                  P                  V4      p\         P                  P                  V4      '       g   KI  Tp M	  Vf   R# \        V 4      p	V	P                  p
 V! V4      P                  V
4      pV'       d%   V^ ,          '       d   ^ M^pW,          V^,          3# R#   T\        3 d    T'       d   h  R# i ; i  \        \        3 d     R# i ; i)z;Returns the Requests tuple auth for a given url from netrc.ZNETRCNc              3   s,   "   T F
  pR V 2x  K  	  R# 5i)z~/N ).0f   & r-   	<genexpr>Z!get_netrc_auth.<locals>.<genexpr>   s     9[Rs8[s   )NetrcParseErrornetrc)r<   environgetNETRC_FILESrI   rH   pathZ
expanduserexistsr   hostnameZauthenticatorsr%   r#   r@   )urlZraise_errorsZ
netrc_fileZnetrc_locationsrH   rI   Z
netrc_pathrE   ZlocZrir,   _netrcZlogin_is   &&           r-   get_netrc_authrR      s    (J%-9[9 0
 A''$$Q'Cww~~c"" 
	 ! c]{{
	:&55d;F%ayy!a33   ) 	  	 ( sH   AD 
D D /-C4 C4 4D	D
D DD D&%D&c                s    \        V RR4      pV'       dX   \        V\        4      '       d@   V^ ,          R8w  d0   VR,          R8w  d    \        P                  P                  V4      # R# R# R# R# )z0Tries to guess the filename of the given object.nameNZ<Z>)getattrr:   r   r<   rM   Zbasename)ZobjrS   rF   r-   guess_filenamerV      sW    3%D
4,,aCDHPSOww%% ET,tr0   c                s   \         P                  P                  V 4      '       d   V # \         P                  P                  V 4      w  rV'       dd   \         P                  P                  V4      '       g?   \         P                  P                  V4      w  rV'       g   MRP	                  W2.4      pKk  \
        P                  ! V4      '       g   V # \
        P                  ! V4      pW$P                  4       9  d   V # \        P                  ! 4       p\         P                  P	                  WRP                  R4      R,          4      p\         P                  P                  V4      '       g?   \        V4      ;_uu_ 4       pVP                  VP                  V4      4       RRR4       V# V#   + '       g   i     T# ; i)zReplace nonexistent paths that look like they refer to a member of a zip
archive with the location of an extracted copy of the target, or else
just return the provided path unchanged.
/NrT   )r<   rM   rN   r'   joinzipfileZ
is_zipfileZZipFileZnamelisttempfileZ
gettempdiratomic_openZwriteZread)rM   ZarchiveZmemberZprefixZzip_fileZtmpZextracted_pathZfile_handlers   &       r-   extract_zipped_pathsr\     s2   
 
ww~~d ggmmD)OG
"''..11''--0 6*+g&&w'H&&(( 


CWW\\#||C'8'<=N77>>.))((Lx}}V45 )> )(s    !F--F>	c              #  sr  "   \         P                  ! \        P                  P	                  V 4      R7      w  r \        P
                  ! VR4      ;_uu_ 4       pVx  RRR4       \        P                  ! W 4       R#   + '       g   i     L(; i  \         d    \        P                  ! T4       h i ; i5i)z-Write a file to the disk in an atomic fashion)ZdirZwbN)	rZ   Zmkstempr<   rM   ZdirnameZfdopenr(   ZBaseExceptionZremove)ZfilenameZtmp_descriptorZtmp_nameZtmp_handlerrA   r-   r[   r[   '  s}       (//BGGOOH4MNNYY~t,, -


8& -,  
		(s4   7B7B A>B <B7>B		B #B44B7c                s    V f   R# \        V \        \        \        \        34      '       d   \        R4      h\        V 4      # )a  Take an object and test to see if it can be represented as a
dictionary. Unless it can not be represented as such, return an
OrderedDict, e.g.,

::

    >>> from_key_val_list([('key', 'val')])
    OrderedDict([('key', 'val')])
    >>> from_key_val_list('string')
    Traceback (most recent call last):
    ...
    ValueError: cannot encode objects that are not 2-tuples
    >>> from_key_val_list({'key': 'val'})
    OrderedDict([('key', 'val')])

:rtype: OrderedDict
N+cannot encode objects that are not 2-tuples)r:   r   r   boolr$   r&   r    valuer/   r-   from_key_val_listra   4  s9    $ }%#udC011FGGur0   c                s    V f   R# \        V \        \        \        \        34      '       d   \        R4      h\        V \        4      '       d   V P                  4       p \        V 4      # )a  Take an object and test to see if it can be represented as a
dictionary. If it can be, return a list of tuples, e.g.,

::

    >>> to_key_val_list([('key', 'val')])
    [('key', 'val')]
    >>> to_key_val_list({'key': 'val'})
    [('key', 'val')]
    >>> to_key_val_list('string')
    Traceback (most recent call last):
    ...
    ValueError: cannot encode objects that are not 2-tuples

:rtype: list
Nr]   )	r:   r   r   r^   r$   r&   r
   r1   Zlistr_   r/   r-   to_key_val_listrb   O  sP    " }%#udC011FGG%!!;r0   c                s    . p\        V 4       F>  pVR,          VRR u;8X  d   R8X  d   M M\        V^R 4      pVP                  V4       K@  	  V# )a  Parse lists as described by RFC 2068 Section 2.

In particular, parse comma-separated lists where the elements of
the list may include quoted-strings.  A quoted-string could
contain a comma.  A non-quoted string could have quotes in the
middle.  Quotes are removed automatically after parsing.

It basically works like :func:`parse_set_header` just that items
may appear multiple times and case sensitivity is preserved.

The return value is a standard :class:`list`:

>>> parse_list_header('token, "quoted value"')
['token', 'quoted value']

To create a header from the :class:`list` again, use the
:func:`dump_header` function.

:param value: a string with a list header.
:return: :class:`list`
:rtype: list
N   NN"rT   )_parse_list_headerunquote_header_valueappend)r`   resultitem   &  r-   parse_list_headerrl   m  sR    . F"5)8tBCy'C''Qr
3Dd * Mr0   c                s    / p\        V 4       FR  pRV9  d   RW&   K  VP                  R^4      w  r0V R,          V RR u;8X  d   R8X  d   M M\        V ^R 4      p WV&   KT  	  V# )a"  Parse lists of key, value pairs as described by RFC 2068 Section 2 and
convert them into a python dict:

>>> d = parse_dict_header('foo="is a fish", bar="as well"')
>>> type(d) is dict
True
>>> sorted(d.items())
[('bar', 'as well'), ('foo', 'is a fish')]

If there is no value for a key it will be `None`:

>>> parse_dict_header('key_without_value')
{'key_without_value': None}

To create a header from the :class:`dict` again, use the
:func:`dump_header` function.

:param value: a string with a dict header.
:return: :class:`dict`
:rtype: dict
=Nrc   re   rT   )rf   r'   rg   )r`   ri   rj   rS   rA   r-   parse_dict_headerrn     sp    , F"5)d?FLjja(9bc
)c)(q5Et * Mr0   c                s    V '       d_   V ^ ,          V R,          u;8X  d   R8X  dB   M V # V ^R p V'       d   V R,          R8w  d#   V P                  RR4      P                  RR4      # V # )zUnquotes a header value.  (Reversal of :func:`quote_header_value`).
This does not use the real unquoting but what browsers are actually
using for quoting.

:param value: the header value to unquote.
:rtype: str
re   N   Nz\\Z\z\"rT   )r(   )r`   Zis_filename   &&r-   rg   rg     sb     qU2Y-#- L a eBi61==.66ucBBLr0   c                sZ    V  Uu/ uF  qP                   VP                  bK  	  ppV# u upi )ztReturns a key/value dictionary from a CookieJar.

:param cj: CookieJar object to extract cookies from.
:rtype: dict
)rS   r`   )cjZcookiecookie_dictrk   r-   dict_from_cookiejarrt     s.     <>>2;;,2K> ?s   (c                s    \        W4      # )zReturns a CookieJar from a key/value dictionary.

:param cj: CookieJar to insert cookies into.
:param cookie_dict: Dict of key/values to insert into CookieJar.
:rtype: CookieJar
r   )rr   rs   rq   r-   add_dict_to_cookiejarru     s     {//r0   c                sv   \         P                  ! R\        4       \        P                  ! R\        P
                  R7      p\        P                  ! R\        P
                  R7      p\        P                  ! R4      pVP                  V 4      VP                  V 4      ,           VP                  V 4      ,           # )zdReturns encodings from given content string.

:param content: bytestring to extract encodings from.
zIn requests 3.0, get_encodings_from_content will be removed. For more information, please see the discussion on issue #2266. (This warning should only appear once.)z!<meta.*?charset=["\']*(.+?)["\'>])Zflagsz+<meta.*?content=["\']*;?charset=(.+?)["\'>]z$^<\?xml.*?encoding=["\']*(.+?)["\'>])r=   r>   DeprecationWarningr)   Zcompiler+   Zfindall)contentZ
charset_reZ	pragma_reZxml_rerA   r-   get_encodings_from_contentrx     s    
 MM1 	 @MJ

IQSQUQUVIZZ?@F 	7#


G
$	%
..
!	"r0   c                sl   V P                  R4      pV^ ,          P                  4       VR,          r2/ pRpV Fx  pVP                  4       pV'       g   K  TRrVP                  R4      p	V	R8w  d/   VRV	 P                  V4      pWi^,           R P                  V4      pWVP                  4       &   Kz  	  W$3# )zReturns content type and parameters from given header

:param header: string
:return: tuple containing content type and dictionary of
     parameters
r!   rd   NNz"' Trm   NrT   )r'   stripZfindZlower)
headerZtokenscontent_typeparamsZparams_dictZitems_to_stripparamkeyr`   Zindex_of_equalss
   &         r-   _parse_content_type_headerr     s     \\#F!!9??,fRj&KN5#jjoO"$,_-33NC134::>J',		$  $$r0   c                s    V P                  R4      pV'       g   R# \        V4      w  rRV9   d   VR,          P                  R4      # RV9   d   R# RV9   d   R# R# )	zqReturns encodings from given HTTP Header Dict.

:param headers: dictionary to extract encoding from.
:rtype: str
zcontent-typeNZcharsetz'"Ztextz
ISO-8859-1zapplication/jsonr4   )rK   r   rz   )headersr|   r}   rk   r-   get_encoding_from_headersr     s^     ;;~.L5lCLFi &&u--\) *r0   c              #  s&  "   VP                   f   T  Rj  xL
  R# \        P                  ! VP                   4      ! RR7      pV  F"  pVP                  V4      pV'       g   K  Vx  K$  	  VP                  RRR7      pV'       d   Vx  R# R#  Lx5i)zStream decodes an iterator.Nr(   Zerrorsr0   T)Zfinal)encodingcodecsZgetincrementaldecoderZdecode)ZiteratorrZdecoderZchunkZrvs   &&   r-   stream_decode_response_unicoder   *  s~      	zz**1::6iHG^^E"2H  
4	(B	 
 	s   BBAB$"B	Bc              #  s   "   ^ pVe   V^ 8:  d   \        V 4      pV\        V 4      8  d   WW!,            x  W!,          pK&  R# 5i)z Iterate over slices of a string.N)r5   )ZstringZslice_lengthZpos   && r-   iter_slicesr   ;  sG     
C|q06{
F
3-.. s   AAc                sT   \         P                  ! R\        4       . p\        V P                  4      pV'       d    \        V P                  V4      #  \        V P                  VRR7      #   \         d    TP                  T4        L7i ; i  \         d    T P                  u # i ; i)zReturns the requested content back in unicode.

:param r: Response object to get unicode content from.

Tried:

1. charset from content-type
2. fall back and replace all unicode characters

:rtype: str
zIn requests 3.0, get_unicode_from_response will be removed. For more information, please see the discussion on issue #2266. (This warning should only appear once.)r(   r   )
r=   r>   rv   r   r   r   rw   ZUnicodeErrorrh   	TypeError)r   Ztried_encodingsr   rk   r-   get_unicode_from_responser   E  s     MM1 	 O )3H	-qyy(++
199hy99  	-""8,	-  yys#   A+ B +B
	B
B'&B'c                s   V P                  R4      p\        ^\        V4      4       F  pW,          R,          p\        V4      ^8X  da   VP                  4       '       dK    \	        \        V^4      4      pT\        9   d   YAT,          R,          ,           Y&   Ks  RY,           2Y&   K  RW,           2W&   K  	  RP                  V4      #   \         d    \        RT R24      hi ; i)zUn-escape any percent-escape sequences in a URI that are unreserved
characters. This leaves all reserved, illegal and non-ASCII bytes encoded.

:rtype: str
Z%:r    rp   Nz"Invalid percent-escape sequence: 'Z':rp   NN )
r'   Zranger5   ZisalnumZchrr$   r&   r   UNRESERVED_SETrX   )uriZpartsZiZhZcs   &    r-   unquote_unreservedr   r  s     IIcNE1c%j!HSMq6Q;199;;LAr
O N"Qx|+uxj>58*~EH " 775>  L #EaS!JKKLs    CC&c                sr    RpRp \        \        V 4      VR7      #   \         d    \        YR7      u # i ; i)zRe-quote the given URI.

This function passes the given URI through an unquote/quote cycle to
ensure that it is fully and consistently quoted.

:rtype: str
z!#$%&'()*+,/:;=?@[]~z!#$&'()*+,/:;=?@[]~)Zsafe)r   r   r   )r   Zsafe_with_percentZsafe_without_percentrk   r-   requote_urir     sG     /0	5 ',3DEE 5 S44	5s    66c                s@    ^V ,          ^,
          W,
          ,          pV# )zConverts a mask from /xx format to a int
to be used as a mask for IP's in int format

Example: if mask is 24 function returns 0xFFFFFF00
         if mask is 24 and totalbits=128 function
            returns 0xFFFFFF00000000000000000000000000

:rtype: int
rC   )maskZ	totalbitsbitsr   r-   _get_mask_bitsr     s     $Y!O!12DKr0   c                s$   VP                  R4      w  r#\        V 4      '       d   \        V4      '       dz   \        P                  ! R\        P
                  ! V 4      4      ^ ,          p\        \        V4      4      p\        P                  ! R\        P
                  ! V4      4      ^ ,          pM\        V 4      '       d   \        V4      '       d   \        P                  ! R\        P                  ! \        P                  V 4      4      w  rxV^@,          V,          p\        \        V4      ^4      p\        P                  ! R\        P                  ! \        P                  V4      4      w  rV	^@,          V
,          pMR# WE,          We,          8H  # )a  This function allows you to check if an IP belongs to a network subnet

Example: returns True if ip = 192.168.1.1 and net = 192.168.1.0/24
         returns False if ip = 192.168.1.1 and net = 192.168.100.0/24
         returns True if ip = 1:2:3:4::1 and net = 1:2:3:4::/64

:rtype: bool
rW   z>Lz>QQF)r'   is_ipv4_addressstructZunpacksocketZ	inet_atonr   r$   is_ipv6_address	inet_ptonAF_INET6)ZipZnetZnetaddrr   ZipaddrZnetmaskZnetworkZ
ipaddr_msbZ
ipaddr_lsbZnetwork_msbZnetwork_lsb   &&         r-   address_in_networkr     s    IIcNMGrw77tV%5%5b%9:1= T+--f&6&6w&?@C			!9!9!'6##FOOR8"

 "j0 TC0#)==6##FOOW=$
  "$3'"344r0   c                s    R^^ V ,
          ,          ^,
          ,          p\         P                  ! \        P                  ! RV4      4      # )zuConverts mask from /xx format to xxx.xxx.xxx.xxx

Example: if mask is 24 function returns 255.255.255.0

:rtype: str
l    z>I)r   Z	inet_ntoar   Zpack)r   r   rF   r-   dotted_netmaskr     s7     b4i1,,DFKKd344r0   c                v     \         P                  ! \         P                  V 4       R#   \         d     R# i ; iz
:rtype: bool
FT)r   r   ZAF_INETr%   Z	string_ipr/   r-   r   r     s4    3      %) 88c                r   r   r   r   r   r%   r   r/   r-   r   r     s4    )4   r   c                s    W8X  d   R#  \         P                  ! \         P                  V 4      \         P                  ! \         P                  V4      8H  #   \         d     R# i ; i)zK
Compare 2 IP's, uses socket.inet_pton to normalize IPv6 IPs

:rtype: bool
TFr   )Zar7   rq   r-   compare_ipsr     sY     	v3v7G7GOOQ8
 
 	
  s   A
A A$#A$c                s(   V P                  R4      ^8X  dj   V P                  R4      w  r \        V4      p\	        T4      '       d   T^8  g   T^ 8  d   R#  R# \        T4      '       d   T^8  g   T^8  d   R#  R# R# R#   \         d     R# i ; i)zJ
Very simple check of the cidr format in no_proxy variable.

:rtype: bool
rW   FT)countr'   r$   r&   r   r   )Zstring_networkZaddressr   rk   r-   is_valid_cidrr     s     C A%&,,S1	t9D 7##ax4"9 %  W%%ax4#: &    		s   B BBc              #  sj  "   VRJpV'       d3   \         P                  P                  V 4      pV\         P                  V &    Rx  V'       d-   Xf   \         P                  V  R# V\         P                  V &   R# R#   T'       d+   Xf   \         P                  T  i T\         P                  T &   i i ; i5i)zSet the environment variable 'env_name' to 'value'

Save previous value, yield, and then restore the previous value stored in
the environment variable 'env_name'.

If 'value' is None, do nothingN)r<   rJ   rK   )Zenv_namer`   Zvalue_changedZ	old_values   &&  r-   set_environr     s      %MJJNN8,	$

81 JJx('0

8$	 = JJx('0

8$	 s   ?B3A< 6B3<4B00B3c                s   R pTpVf	   V! R4      p\        V 4      pVP                  f   R# V'       Ed2   R VP                  RR4      P                  R4       4       p\	        VP                  4      '       g   \        VP                  4      '       d\   V FT  p\        V4      '       d"   \        VP                  V4      '       d    R# K5  \        VP                  V4      '       g   KS   R# 	  MxVP                  pVP                  '       d   VR	VP                   2,          pV F>  pVP                  P                  V4      '       g   VP                  V4      '       g   K=   R# 	  \        RV4      ;_uu_ 4         \        VP                  4      pRRR4       X'       d   R# R
#   \        \        P                  3 d    R
p L3i ; i  + '       g   i     L?; i)z@
Returns whether we should bypass proxies or not.

:rtype: bool
c                 s    \         P                  P                  V 4      ;'       g.    \         P                  P                  V P                  4       4      # N)r<   rJ   rK   Zupper)r   r/   r-   	get_proxyZ(should_bypass_proxies.<locals>.get_proxy5  s0    zz~~c"AAbjjnnSYY[&AAr0   Nno_proxyTc              3   s8   "   T F  q'       g   K  Vx  K  	  R # 5ir   rC   )rD   r,   rF   r-   rG   Z(should_bypass_proxies.<locals>.<genexpr>F  s     R%ITTDD%Is   	
Z r   Z,Z:F)r   rO   r(   r'   r   r   r   r   r   portZendswithr   r   r   r   Zgaierror)	rP   r   r   Zno_proxy_argparsedZproxy_ipZhost_with_portr,   Zbypasss	   &&       r-   should_bypass_proxiesr   ,  sx   B
 LZ(c]Fx SX%5%5c2%>%D%DS%IR6??++v/O/O$ **)&//8DD# E (;;   % $__N{{{Afkk]"33 ??++D11^5L5LT5R5R  	 ! 
Z	.	.	!&//2F 
/  6??+ 	F		 
/	.s*   ;G	=F&&GG	GG		G	c                s>    \        WR7      '       d   / # \        4       # )z5
Return a dict of environment proxies.

:rtype: dict
r   )r   r   )rP   r   rq   r-   get_environ_proxiesr   i  s     S44	|r0   c                sd   T;'       g    / p\        V 4      pVP                  f,   VP                  VP                  VP                  R4      4      # VP                  R,           VP                  ,           VP                  RVP                  ,           R.pRpV F  pWQ9   g   K  W,          p V# 	  V# )zSelect a proxy for the url, if applicable.

:param url: The url being for the request
:param proxies: A dictionary of schemes or schemes and hosts to proxy URLs
Nallz://zall://)r   rO   rK   scheme)rP   proxiesZurlpartsZ
proxy_keysproxyZ	proxy_keys   &&    r-   select_proxyr   u  s     mmG}H {{8??GKK,>?? 	%("3"338$$$	J E	&EL  
 Lr0   c                sX   Ve   TM/ pV P                   p\        V4      P                  pVP                  R4      pVP	                  4       pV'       dX   \        W5R7      '       gF   \        W5R7      pVP                  WGP                  R4      4      pV'       d   VP                  WH4       V# )a  This method takes proxy information from a request and configuration
input to resolve a mapping of target proxies. This will consider settings
such as NO_PROXY to strip proxy configurations.

:param request: Request or PreparedRequest
:param proxies: A dictionary of schemes or schemes and hosts to proxy URLs
:param trust_env: Boolean declaring whether to trust environment configs

:rtype: dict
r   r   r   )rP   r   r   rK   Zcopyr   r   Z
setdefault)	Zrequestr   Z	trust_envrP   r   r   Znew_proxiesZenviron_proxiesr   s	   &&&      r-   resolve_proxiesr     s     !,g"G
++Cc]!!F{{:&H,,.K.sFF-cE##F,?,?,FG""61r0   c                s    V  R\          2# )zC
Return a string representing the default user agent.

:rtype: str
rW   r   )rS   r/   r-   default_user_agentr     s     V1[M""r0   c            
     s@    \        R\        4       R\        RRRR/4      # )z1
:rtype: requests.structures.CaseInsensitiveDict
z
User-AgentzAccept-EncodingZAcceptz*/*Z
Connectionz
keep-alive)r   r   DEFAULT_ACCEPT_ENCODINGrC   r0   r-   default_headersr     s/     ,.6e,		
 r0   c                s   . pRpV P                  V4      p V '       g   V# \        P                  ! RV 4       F  p VP                  R^4      w  rERVP                  R4      /pVP                  R4       F9  p VP                  R4      w  rT P                  T4      YhP                  T4      &   K;  	  VP	                  V4       K  	  V#   \         d    TRrT Li ; i  \         d      K:  i ; i)zReturn a list of parsed link headers proxies.

i.e. Link: <http:/.../front.jpeg>; rel=front; type="image/jpeg",<http://.../back.jpeg>; rel=back;type="image/jpeg"

:rtype: list
z '"z, *<r!   r   rP   z<> '"rm   )rz   r)   r'   r&   rh   )	r`   ZlinksZreplace_charsZvalrP   r}   Zlinkr~   r   s	   &        r-   parse_header_linksr     s     EMKK&Exx&	"))C+KC syy*+\\#&E"[[-
 .3[[-GD=)* ' 	T! '$ L  	"r	"  s#   C7CCCC+*C+Z Zasciic                s   V R,          pV\         P                  \         P                  39   d   R# VR,          \         P                  8X  d   R# VR,          \         P                  \         P
                  39   d   R# VP                  \        4      pV^ 8X  d   R# V^8X  d)   VR,          \        8X  d   R	# VR
,          \        8X  d   R# V^8X  d)   VR,          \        8X  d   R# VR,          \        8X  d   R# R# )z
:rtype: str
:Ni   Nzutf-32:Ni   Nz	utf-8-sigro   zutf-16r4   :NNrp   z	utf-16-be:rd   Nrp   z	utf-16-lez	utf-32-bery   z	utf-32-leN)
r   ZBOM_UTF32_LEZBOM_UTF32_BEZBOM_UTF8ZBOM_UTF16_LEZBOM_UTF16_BEr   _null_null2_null3)ZdataZsampleZ	nullcountrk   r-   guess_json_utfr     s     "XF&%%v':':;;bzV__$bzf))6+>+>??U#IA~A~#;& $<6!A~":":r0   c                s    \        V 4      pVw  r4rVrxp	VP                  p
V
'       g   YzrzV'       d   RP                  WJ.4      p
Vf   TpVf   Rp\        W:VRW34      # )zGiven a URL that may or may not have a scheme, prepend the given scheme.
Does not replace a present scheme with the one provided as an argument.

:rtype: str
@r   )r   netlocrX   r   )rP   Z
new_schemer   r   authr,   r   rM   queryfragmentr   r   r-   prepend_scheme_if_neededr     sk     s^F6<3F$d8 ]]F 4.)~|vtRABBr0   c                s    \        V 4      p \        VP                  4      \        VP                  4      3pV#   \        \
        3 d    Rp T# i ; i)zoGiven a url with authentication components, extract them into a tuple of
username,password.

:rtype: (str,str)
)r   r   )r   r   ZusernameZpasswordr@   r   )rP   r   r   rk   r-   get_auth_from_urlr   )  sU     c]F('&//*BC K I& Ks   *9 AAc                s>    V w  r\        W^ 4       \        W^4       R# )zVerifies that header parts don't contain leading whitespace
reserved characters, or return characters.

:param header: tuple, in the format (name, value).
N)_validate_header_part)r{   rS   r`   rk   r-   check_header_validityr   9  s     KD&*&+r0   c           
      s:   \        V\        4      '       d   \        V,          pMB\        V\        4      '       d   \        V,          pM\        R V: RV  R\        V4       24      hVP                  V4      '       g   V^ 8X  d   RMRp\        RV RV: 24      hR# )zHeader part (z) from z# must be of type str or bytes, not rS   r`   zTInvalid leading whitespace, reserved character(s), or return character(s) in header z: N)r:   r   r   r   r   r   Ztyper*   )r{   Zheader_partZheader_validator_indexZ	validatorZheader_kinds   &&&  r-   r   r   D  s    +s##*+AB		K	'	'+,BC	K?'& :115k1B0CE
 	

 ??;'' 6! ;f&&1]"[OE
 	
 (r0   c                s    \        V 4      w  rr4rVV'       g   Y2r2VP                  R^4      R,          p\        WW4VR34      # )zK
Given a url remove the fragment and the authentication part.

:rtype: str
r   r   rT   )r   Zrsplitr   )rP   r   r   rM   r}   r   r   s   &      r-   urldefragauthr   W  sG     5=SM1FD% ]]3"2&FvtUB?@@r0   c                s    \        V P                  RR4      pVe6   \        V P                  \        4      '       d    V! V P                  4       R# \        R4      h  \
         d    \        R4      hi ; i)z^Move file pointer back to its recorded starting position
so it can be read again on redirect.
r9   Nz;An error occurred when rewinding request body for redirect.z+Unable to rewind request body for redirect.)rU   Zbodyr:   Z_body_positionr   r%   r   )Zprepared_requestZ	body_seekrF   r-   rewind_bodyr   h  sy     (--vt<I''" "	&556 $$QRR  	'M 	s   A A3)z.netrcrQ   )FzBABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~)i    r   )T)zpython-requests)nZ__doc__r   Z
contextlibr?   r<   r)   r   r   ZsysrZ   r=   rY   Zcollectionsr    Zurllib3.utilr   r   r   r   r   Z_internal_utilsr   r   r   r	   Zcompatr
   r   r   r   r   r   r   r   rf   r   r   r   r   r   r   r   Zcookiesr   Z
exceptionsr   r   r   r   Z
structuresr   rL   ZwhereZDEFAULT_CA_BUNDLE_PATHZDEFAULT_PORTSrX   r'   r   Zplatformr.   r3   rB   rR   rV   r\   Zcontextmanagerr[   ra   rb   rl   rn   rg   rt   ru   rx   r   r   r   r   r   Z	frozensetr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r;   r   r   r   r   r   r   r   r   r   r   rC   r0   r-   <module>r      s     	 	 	   
    # 0  $    :   )  ," Wc* ))HHWl489JKL 
 <<7$L	/D3N)X&"J 	 	6<@F202%22"$P M
05,5:5 4 1 1*:z	46#"L 	g		@C: ,
&A"Sr0   