+
    i              	          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 RBt3]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=RCR lt>R t?R t@]P                  R 4       tBR tCR tDR  tER! tFRCR" ltGR# tHR$ tIR% tJR& tKR' tLR( tMR) tNR* tO]P! RD4      tQR+ tRR, tSR- tTR. tUR/ tVR0 tW]P                  R1 4       tXR2 tYRER3 ltZR4 t[RFR5 lt\RGR6 lt]R7 t^R8 t_R9P                  R:4      ta]a^,          tb]a^,          tcR; tdR< teR= tfR> tgR? thR@ tiRA tjR# )Hz
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)CaseInsensitiveDicthttphttpsi  z, z,\s*T)accept_encodingzaccept-encodingwin32c                 n    ^ 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 SettingsProxyEnableProxyOverride;z<local>.Tz\.*z.*?)winregImportErrorOpenKeyHKEY_CURRENT_USERintQueryValueExOSError
ValueErrorsplitfilterreplacerematchI)hostr.   internetSettingsproxyEnableproxyOverridetests   &     T/Users/ahmad/.openclaw/workspace/venv/lib/python3.14/site-packages/requests/utils.pyproxy_bypass_registryrB   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                N    \        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   rB   )r<   s   &rA   r   r   s   s#     "##+D11(..    c                J    \        V R4      '       d   V P                  4       p V # )z/Returns an internal sequence dictionary update.items)hasattrrF   )ds   &rA   dict_to_sequencerI      s!     q'GGIHrD   c                 |   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-8__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   encoderG   rM   rN   osfstatst_sizemodewarningswarnr   ioUnsupportedOperationAttributeErrorrP   rQ   r4   max)ototal_lengthcurrent_positionrN   s   &   rA   	super_lenra      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                R   \         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.NETRCNc              3   ,   "   T F
  pR V 2x  K  	  R# 5i)z~/N ).0fs   & rA   	<genexpr>!get_netrc_auth.<locals>.<genexpr>   s     9[Rs8[s   )NetrcParseErrornetrc)rT   environgetNETRC_FILESrk   rj   path
expanduserexistsr   hostnameauthenticatorsr4   r/   r\   )urlraise_errors
netrc_filenetrc_locationsrj   rk   
netrc_pathrg   locrir<   _netrclogin_is   &&           rA   get_netrc_authr}      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                    \        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.nameN<>)getattrrR   r   rT   ro   basename)objr   s   & rA   guess_filenamer      sW    3%D
4,,aCDHPSOww%% ET,trD   c                   \         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.
/Nr   )rT   ro   rq   r6   joinzipfile
is_zipfileZipFilenamelisttempfile
gettempdiratomic_openwriteread)ro   archivememberprefixzip_filetmpextracted_pathfile_handlers   &       rA   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              #  r  "   \         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)dirwbN)	r   mkstemprT   ro   dirnamefdopenr8   BaseExceptionremove)filenametmp_descriptortmp_nametmp_handlers   &   rA   r   r   '  s}       (//BGGOOH4MNNYY~t,, -


8& -,  
		(s4   7B7B A>B <B7>B		B #B44B7c                    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)rR   r   r   boolr2   r5   r   values   &rA   from_key_val_listr   4  s9    $ }%#udC011FGGurD   c                    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   )	rR   r   r   r   r2   r5   r   rF   listr   s   &rA   to_key_val_listr   O  sP    " }%#udC011FGG%!!;rD   c                    . 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"r   )_parse_list_headerunquote_header_valueappend)r   resultitems   &  rA   parse_list_headerr   m  sR    . F"5)8tBCy'C''Qr
3Dd * MrD   c                    / 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
=Nr   r   r   )r   r6   r   )r   r   r   r   s   &   rA   parse_dict_headerr     sp    , F"5)d?FLjja(9bc
)c)(q5Et * MrD   c                    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
r   N   Nz\\\z\"r   )r8   )r   is_filenames   &&rA   r   r     sb     qU2Y-#- L a eBi61==.66ucBBLrD   c                Z    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
)r   r   )cjcookiecookie_dicts   &  rA   dict_from_cookiejarr     s.     <>>2;;,2K> ?s   (c                    \        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   )r   r   s   &&rA   add_dict_to_cookiejarr     s     {//rD   c                v   \         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=["\']*(.+?)["\'>])flagsz+<meta.*?content=["\']*;?charset=(.+?)["\'>]z$^<\?xml.*?encoding=["\']*(.+?)["\'>])rX   rY   DeprecationWarningr9   compiler;   findall)content
charset_re	pragma_rexml_res   &   rA   get_encodings_from_contentr     s    
 MM1 	 @MJ

IQSQUQUVIZZ?@F 	7#


G
$	%
..
!	"rD   c                l   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*   r   NNz"' Tr   Nr   )r6   stripfindlower)
headertokenscontent_typeparamsparams_dictitems_to_stripparamkeyr   index_of_equalss
   &         rA   _parse_content_type_headerr     s     \\#F!!9??,fRj&KN5#jjoO"$,_-33NC134::>J',		$  $$rD   c                    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-typeNcharsetz'"textz
ISO-8859-1zapplication/jsonrK   )rm   r   r   )headersr   r   s   &  rA   get_encoding_from_headersr     s^     ;;~.L5lCLFi &&u--\) *rD   c              #  &  "   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.Nr8   errorsrD   T)final)encodingcodecsgetincrementaldecoderdecode)iteratorrdecoderchunkrvs   &&   rA   stream_decode_response_unicoder   *  s~      	zz**1::6iHG^^E"2H  
4	(B	 
 	s   BBAB$"B	Bc              #     "   ^ 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)rM   )stringslice_lengthposs   && rA   iter_slicesr   ;  sG     
C|q06{
F
3-.. s   AAc                T   \         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.)r8   r   )
rX   rY   r   r   r   r   r   UnicodeErrorr   	TypeError)r   tried_encodingsr   s   &  rA   get_unicode_from_responser   E  s     MM1 	 O )3H	-qyy(++
199hy99  	-""8,	-  yys#   A+ B +B
	B
B'&B'c                   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
%:r'   r   Nz"Invalid percent-escape sequence: '':r   NN )
r6   rangerM   isalnumchrr2   r5   r   UNRESERVED_SETr   )uripartsihcs   &    rA   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                r    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!#$&'()*+,/:;=?@[]~)safe)r   r  r   )r  safe_with_percentsafe_without_percents   &  rA   requote_urir    sG     /0	5 ',3DEE 5 S44	5s    66c           
        \         P                  ! R\        P                  ! V 4      4      ^ ,          pVP	                  R4      w  r4\         P                  ! R\        P                  ! \        \        V4      4      4      4      ^ ,          p\         P                  ! R\        P                  ! V4      4      ^ ,          V,          pW%,          We,          8H  # )zThis 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

:rtype: bool
z=Lr   )structunpacksocket	inet_atonr6   dotted_netmaskr2   )ipnetipaddrnetaddrbitsnetmasknetworks   &&     rA   address_in_networkr    s     ]]4!1!1"!56q9FIIcNMGmmD&"2"2>#d)3L"MNqQGmmD&"2"27";<Q?'IG'"344rD   c                    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  	inet_ntoar  pack)maskr  s   & rA   r  r    s7     b4i1,,DFKKd344rD   c                X     \         P                  ! V 4       R#   \         d     R# i ; i)z
:rtype: bool
FT)r  r  r4   )	string_ips   &rA   is_ipv4_addressr&    s.    #   s    ))c                <   V P                  R4      ^8X  db    \        V P                  R4      ^,          4      pT^8  g   T^ 8  d   R#  \        P
                  ! T P                  R4      ^ ,          4       R# R#   \         d     R# i ; i  \         d     R# i ; i)zJ
Very simple check of the cidr format in no_proxy variable.

:rtype: bool
r   FT)countr2   r6   r5   r  r  r4   )string_networkr#  s   & rA   is_valid_cidrr*    s     C A%	~++C034D !8tby	^11#6q9:
    		  		s#   !A: 
,B :B	B	BBc              #  j  "   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)rT   rl   rm   )env_namer   value_changed	old_values   &&  rA   set_environr/    s      %MJJNN8,	$

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

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

8$	 s   ?B3A< 6B3<4B00B3c                l   R pTpVf	   V! R4      p\        V 4      pVP                  f   R# V'       Ed   R VP                  RR4      P                  R4       4       p\	        VP                  4      '       dQ   V FI  p\        V4      '       d"   \        VP                  V4      '       d    R# K5  VP                  V8X  g   KH   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                     \         P                  P                  V 4      ;'       g.    \         P                  P                  V P                  4       4      # N)rT   rl   rm   upper)r   s   &rA   	get_proxy(should_bypass_proxies.<locals>.get_proxy  s0    zz~~c"AAbjjnnSYY[&AArD   Nno_proxyTc              3   8   "   T F  q'       g   K  Vx  K  	  R # 5ir2  re   )rf   r<   s   & rA   rh   (should_bypass_proxies.<locals>.<genexpr>  s     R%ITTDD%Is   	
 r  ,:F)r   rr   r8   r6   r&  r*  r  portendswithr/  r   r   r  gaierror)	rt   r6  r4  no_proxy_argparsedproxy_iphost_with_portr<   bypasss	   &&       rA   should_bypass_proxiesrD    se   B
 LZ(c]Fx SX%5%5c2%>%D%DS%IR6??++$ **)&//8DD# E__0   % $__N{{{Afkk]"33 ??++D11^5L5LT5R5R  	 ! 
Z	.	.	!&//2F 
/  6??+ 	F		 
/	.s*   F#F  F F#F  F##F3	c                >    \        WR7      '       d   / # \        4       # )z5
Return a dict of environment proxies.

:rtype: dict
r6  )rD  r   )rt   r6  s   &&rA   get_environ_proxiesrG  0  s     S44	|rD   c                d   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   rr   rm   scheme)rt   proxiesurlparts
proxy_keysproxy	proxy_keys   &&    rA   select_proxyrP  <  s     mmG}H {{8??GKK,>?? 	%("3"338$$$	J E	&EL  
 LrD   c                X   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
r6  rF  rI  )rt   r   rJ  rm   copyrD  rG  
setdefault)	requestrK  	trust_envrt   rJ  r6  new_proxiesenviron_proxiesrN  s	   &&&      rA   resolve_proxiesrX  V  s     !,g"G
++Cc]!!F{{:&H,,.K.sFF-cE##F,?,?,FG""61rD   c                    V  R\          2# )zC
Return a string representing the default user agent.

:rtype: str
r   r   )r   s   &rA   default_user_agentrZ  q  s     V1[M""rD   c            
     @    \        R\        4       R\        RRRR/4      # )z1
:rtype: requests.structures.CaseInsensitiveDict
z
User-AgentzAccept-EncodingAcceptz*/*
Connectionz
keep-alive)r!   rZ  DEFAULT_ACCEPT_ENCODINGre   rD   rA   default_headersr_  z  s/     ,.6e,		
 rD   c                   . 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  rt   z<> '"r   )r   r9   r6   r5   r   )	r   linksreplace_charsvalrt   r   linkr   r   s	   &        rA   parse_header_linksre    s     EMKK&Exx&	"))C+KC syy*+\\#&E"[[-
 .3[[-GD=)* ' 	T! '$ L  	"r	"  s#   C7CCCC+*C+ asciic                   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
:N   Nzutf-32:N   Nz	utf-8-sigr   zutf-16rK   :NNr   z	utf-16-be:r   Nr   z	utf-16-lez	utf-32-ber   z	utf-32-leN)
r   BOM_UTF32_LEBOM_UTF32_BEBOM_UTF8BOM_UTF16_LEBOM_UTF16_BEr(  _null_null2_null3)datasample	nullcounts   &  rA   guess_json_utfrv    s     "XF&%%v':':;;bzV__$bzf))6+>+>??U#IA~A~#;& $<6!A~":":rD   c                    \        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   netlocr   r   )rt   
new_schemer@  rJ  authr<   r<  ro   queryfragmentry  s   &&         rA   prepend_scheme_if_neededr~    sk     s^F6<3F$d8 ]]F 4.)~|vtRABBrD   c                    \        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   usernamepasswordr\   r   )rt   r@  r{  s   &  rA   get_auth_from_urlr    sU     c]F('&//*BC K I& Ks   *9 AAc                >    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   r   r   s   &  rA   check_header_validityr     s     KD&*&+rD   c           
      :   \        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 r   r   zTInvalid leading whitespace, reserved character(s), or return character(s) in header z: N)rR   r   r	   r   r   r   typer:   )r   header_partheader_validator_index	validatorheader_kinds   &&&  rA   r  r    s    +s##*+AB		K	'	'+,BC	K?'& :115k1B0CE
 	

 ??;'' 6! ;f&&1]"[OE
 	
 (rD   c                    \        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
rx  r  r   )r   rsplitr   )rt   rJ  ry  ro   r   r|  r}  s   &      rA   urldefragauthr    sG     5=SM1FD% ]]3"2&FvtUB?@@rD   c                    \        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.
rQ   Nz;An error occurred when rewinding request body for redirect.z+Unable to rewind request body for redirect.)r   bodyrR   _body_positionr   r4   r    )prepared_request	body_seeks   & rA   rewind_bodyr  /  sy     (--vt<I''" "	&556 $$QRR  	'M 	s   A A3)z.netrcr{   )FzBABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~r2  )T)zpython-requests)k__doc__r   
contextlibrZ   rT   r9   r  r  sysr   rX   r   collectionsr   urllib3.utilr   r   r  r   r   _internal_utilsr   r	   r
   r   compatr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   cookiesr   
exceptionsr   r   r   r    
structuresr!   rn   whereDEFAULT_CA_BUNDLE_PATHDEFAULT_PORTSr   r6   r^  platformrB   rI   ra   r}   r   r   contextmanagerr   r   r   r   r   r   r   r   r   r   r   r   r   r   	frozensetr  r  r  r  r  r&  r*  r/  rD  rG  rP  rX  rZ  r_  re  rS   rp  rq  rr  rv  r~  r  r  r  r  r  re   rD   rA   <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0 1 1*:z	46#"L 	g		@C: ,
&A"SrD   