
    vKgH                     >   S SK r S SKrS SKrS SKrS SKrS SKrS SKJr  S SKJ	r	J
r
Jr  S SKJr  S SKJrJrJrJr  S SKJr  S SKJr  S SKJr  S S	KJrJrJrJrJrJr  S S
K J!r!   S SKJ"r"J#r#   \RJ                  " 5          \RL                  " S\'S9  S SK(J)r*  SSS5         S SKJ+r+  S SK,r-S SK.J/r/J0r0J1r1J2r2J3r3  S SK4J5r5JrJ6r6J7r7J8r8J9r9JrJr  \1" 5         \ Rt                  " \;5      r<Sr=Sr>\R~                  R                  \R~                  R                  \B5      S5      rC S SKDJErE  S rF S!S jrGS rHS rIS rJ " S S5      rK " S S 5      rLg! \$ a    S SKJ"r"J#r#   Nf = f! , (       d  f       N= f! \$ a	    S SKJ*r*   Nf = f! \$ a    Sr+ Nf = f! \$ a    S rE Nwf = f)"    N)	b64encode)PoolManagerTimeoutproxy_from_url)ConnectTimeoutError)LocationParseErrorNewConnectionErrorProtocolError
ProxyError)ReadTimeoutError)SSLError)Retry)OP_NO_COMPRESSIONPROTOCOL_TLSOP_NO_SSLv2OP_NO_SSLv3is_ipaddressssl)	parse_url)OP_NO_TICKETPROTOCOL_TLS_CLIENTignore)category)orig_util_SSLContext)
SSLContext)DEFAULT_CIPHERS)IPV6_ADDRZ_REensure_bytesfilter_ssl_warningsunquoteurlparse)ConnectionClosedErrorr   EndpointConnectionErrorHTTPClientErrorInvalidProxiesConfigErrorProxyConnectionErrorr   r   <   
   z
cacert.pem)wherec                      [         $ N)DEFAULT_CA_BUNDLE     T/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/botocore/httpsession.pyr)   r)   X   s      r.   c                 X    U SLa  U $ [        5       n[        R                  SU 35        U$ )NTzCertificate path: )r)   loggerdebug)verify	cert_paths     r/   get_cert_pathr5   \   s0    TI
LL%i[12r.   c                   ^ U (       a
  U [         :X  a  [        n [        U 5      mU(       a  TR                  U5        O [        (       a  TR                  [        5        Uc  [
        R                  OUnUc&  SnU[        -  nU[        -  nU[        -  nU[        -  nT=R                  U-  sl        U[
        R                  :X  d  [        R                  S:  a  [        TSS5      b  STl        U4S jnU[
        R                  :X  a  UTl        U" 5         OU" 5         UTl        [#        TS5      (       aL  [$        R&                  R)                  S5      nU(       a&  [        R*                  R,                  (       d  UTl        T$ )	zThis function is a vendored version of the same function in urllib3

We vendor this function to ensure that the SSL contexts we construct
always use the std lib SSLContext instead of pyopenssl.
Nr   )         post_handshake_authTc                  2   > [        T SS 5      b  ST l        g g )Ncheck_hostnameF)getattrr<   )contexts   r/   disable_check_hostname6create_urllib3_context.<locals>.disable_check_hostname   s#    G-t4@ &+G"	 Ar.   keylog_filenameSSLKEYLOGFILE)r   r   r   set_ciphersr   r   CERT_REQUIREDr   r   r   r   optionssysversion_infor=   r:   verify_modehasattrosenvirongetflagsignore_environmentrA   )ssl_version	cert_reqsrE   ciphersr?   sslkeylogfiler>   s         @r/   create_urllib3_contextrS   f   s?    +5)%GG$	O, &/%6!!II;; 	$$
 	<OOwO 	S&&&#*:*:i*G
'0$
7
C&*#+ C%%%'  ' w)**

7!=!=&3G#Nr.   c                 V    [        U [        5      (       a  U $ U R                  5       S:H  $ )zvEnsures a boolean value if a string or boolean is provided

For strings, the value for True/False is case insensitive
true)
isinstanceboollower)vals    r/   ensure_booleanrZ      s'    
 #t
yy{f$$r.   c                     Sn[        U 5      nUR                  (       a  U R                  UR                  US5      n UR                  (       a  U R                  UR                  US5      n U $ )z
Mask proxy url credentials.

:type proxy_url: str
:param proxy_url: The proxy url, i.e. https://username:password@proxy.com

:return: Masked proxy url, i.e. https://***:***@proxy.com
z***   )r!   usernamereplacepassword)	proxy_urlmask
parsed_urls      r/   mask_proxy_urlrc      s_     D)$J%%j&9&94C	%%j&9&94C	r.   c                 d    [        U 5      =(       d    [        [        R                  " U 5      5      $ )z@Wrap urllib3's is_ipaddress to support bracketed IPv6 addresses.)r   rW   r   match)hosts    r/   _is_ipaddressrg      s"    @m&9&9$&?!@@r.   c                   P    \ rS rSrSrSS jrS rS r\S 5       r	S r
S	 rS
 rSrg)ProxyConfiguration   zRepresents a proxy configuration dictionary and additional settings.

This class represents a proxy configuration dictionary and provides utility
functions to retrieve well structured proxy urls and proxy headers from the
proxy configuration dictionary.
Nc                 0    Uc  0 nUc  0 nXl         X l        g r+   _proxies_proxies_settings)selfproxiesproxies_settingss      r/   __init__ProxyConfiguration.__init__   s#    ?G#!!1r.   c                     [        U5      nU R                  R                  UR                  5      nU(       a  U R	                  U5      nU$ )z6Retrieves the corresponding proxy url for a given url.)r!   rm   rL   scheme_fix_proxy_url)ro   urlrb   proxys       r/   proxy_url_for ProxyConfiguration.proxy_url_for   s=    c]
!!*"3"34''.Er.   c                 v    0 nU R                  U5      u  p4U(       a  U(       a  U R                  X45      nXRS'   U$ )z@Retrieves the corresponding proxy headers for a given proxy url.zProxy-Authorization)_get_auth_from_url_construct_basic_auth)ro   r`   headersr]   r_   
basic_auths         r/   proxy_headers_for$ProxyConfiguration.proxy_headers_for   s=    !44Y?33HGJ-7)*r.   c                     U R                   $ r+   )rn   ro   s    r/   settingsProxyConfiguration.settings   s    %%%r.   c                     UR                  S5      (       d  UR                  S5      (       a  U$ UR                  S5      (       a  SU-   $ SU-   $ )Nhttp:zhttps:z//zhttp://)
startswith)ro   r`   s     r/   rv   !ProxyConfiguration._fix_proxy_url   sP    ((I,@,@,J,J!!$''Y&&y((r.   c                     U SU 3n[        UR                  S5      5      R                  5       R                  5       nSU 3$ )N:asciizBasic )r   encodestripdecode)ro   r]   r_   auth_strencoded_strs        r/   r}   (ProxyConfiguration._construct_basic_auth  sD    Zq
+ 89??AHHJ}%%r.   c                     [        U5      n [        UR                  5      [        UR                  5      4$ ! [        [
        4 a     gf = f)NNN)r!   r    r]   r_   AttributeError	TypeError)ro   rw   rb   s      r/   r|   %ProxyConfiguration._get_auth_from_url  sH    c]
	:../9L9L1MMM	* 		s   )7 A
	A
rl   r   )__name__
__module____qualname____firstlineno____doc__rr   ry   r   propertyr   rv   r}   r|   __static_attributes__r-   r.   r/   ri   ri      s9    2 & &)&
r.   ri   c                   |    \ rS rSrSrSSS\SSS4S jrS rS rS r	S	 r
S
 rS rS rSS jrS rS rS rS rSrg)URLLib3Sessioni  a?  A basic HTTP client that supports connection pooling and proxies.

This class is inspired by requests.adapters.HTTPAdapter, but has been
boiled down to meet the use cases needed by botocore. For the most part
this classes matches the functionality of HTTPAdapter in requests v2.7.0
(the same as our vendored version). The only major difference of note is
that we currently do not support sending chunked requests. While requests
v2.7.0 implemented this themselves, later version urllib3 support this
directly via a flag to urlopen so enabling it if needed should be trivial.
TNc                 \   Xl         [        X'S9U l        [        R                  R
                  [        R                  R                  S.U l        Uc  [        n[        U[        [        45      (       d  [        US   US   S9nS U l        S U l        [        U[        5      (       a  X`l        O$[        U[         5      (       a  Uu  U l        U l        X0l        X@l        XPl        Uc  / U l        0 U l        [+        S0 U R-                  5       D6U l        U R                  U R.                  l        g )N)rp   rq   )httphttpsr   r\   )connectreadr-   )_verifyri   _proxy_configbotocore
awsrequestAWSHTTPConnectionPoolAWSHTTPSConnectionPool_pool_classes_by_schemeDEFAULT_TIMEOUTrV   intfloatr   
_cert_file	_key_filestrtuple_timeout_max_pool_connections_socket_options_proxy_managersr   _get_pool_manager_kwargs_managerpool_classes_by_scheme)ro   r3   rp   timeoutmax_pool_connectionssocket_optionsclient_certproxies_configs           r/   rr   URLLib3Session.__init__  s     /
 ''==((??(
$ ?%G'C<00gajwqzBGk3'')OU++.9+DOT^%9"-!#%D !#Fd&C&C&EF/3/K/K,r.   c                     U R                   R                  nSUR                  S5      0UEnUR                  5        VVs0 sH  u  pEUc  M
  XE_M     snn$ s  snnf )Nuse_forwarding_for_httpsproxy_use_forwarding_for_https)r   r   rL   items)ro   kwargsrq   proxies_kwargskvs         r/   _proxies_kwargsURLLib3Session._proxies_kwargsF  sf    --66&(8(<(<0)
 	
 "0!5!5!7I!71!7IIIs   AAc                     U R                   U R                  U R                  5       U R                  U R                  U R
                  S.nUR                  " S0 UD6  U$ )N)r   maxsizessl_contextr   	cert_filekey_filer-   )r   r   _get_ssl_contextr   r   r   update)ro   extra_kwargspool_manager_kwargss      r/   r   'URLLib3Session._get_pool_manager_kwargsP  sV    }}11002"22
 	""2\2""r.   c                     [        5       $ r+   )rS   r   s    r/   r   URLLib3Session._get_ssl_context\  s    %''r.   c                 F   XR                   ;  a  U R                  R                  U5      nU R                  U5      nU R	                  US9nUR                  U R                  US95        [        U40 UD6nU R                  Ul	        XPR                   U'   U R                   U   $ )N)proxy_headers)proxy_ssl_context)
r   r   r   _setup_proxy_ssl_contextr   r   r   r   r   r   )ro   r`   r   r   proxy_manager_kwargsproxy_managers         r/   _get_proxy_manager!URLLib3Session._get_proxy_manager_  s    000 ..@@KM $ = =i H#'#@#@+ $A $  !''$$7H$I +9M8LMM373O3OM0.;  +##I..r.   c                     [        U5      nUR                  nU(       d  SnUR                  (       a  US-   UR                  -   nU$ )N/?)r!   pathquery)ro   rw   rb   r   s       r/   	_path_urlURLLib3Session._path_urlo  s>    c]
D#:
 0 00Dr.   c                     UR                  5       R                  S5      (       a  U(       a  SUl        [        U5      Ul        g SUl        S Ul        g )Nr   rD   	CERT_NONE)rX   r   rP   r5   ca_certs)ro   connrw   r3   s       r/   _setup_ssl_certURLLib3Session._setup_ssl_certx  s<    99;!!'**v,DN)&1DM(DN DMr.   c                    U R                   R                  nUR                  S5      nUR                  S5      nUc  Uc  g U R                  5       n [	        U5      n[        UR                  5      (       d  SUl        Ub  UR                  US9  [        U[        5      (       a  UR                  US   US   S9  U$ [        U[        5      (       a  UR                  U5        U$ ! [        [        [        4 a  n[!        US9eS nAff = f)	Nproxy_ca_bundleproxy_client_certT)cafiler   r\   )keyfileerror)r   r   rL   r   r   rg   rf   r<   load_verify_locationsrV   r   load_cert_chainr   OSErrorURLLib3SSLErrorr   r%   )ro   r`   rq   r   
proxy_certr>   rw   es           r/   r   'URLLib3Session._setup_proxy_ssl_context  s   --66*../@A%))*=>
"z'9'')	5I&C !**)-&*--_-E*e,,''
1z!}'M N J,,''
3N*<= 	5+!44	5s   A*C$ <'C$ $D9	DDc                 R    U(       a  U R                  U5      nU$ U R                  nU$ r+   )r   r   )ro   rw   r`   managers       r/   _get_connection_manager&URLLib3Session._get_connection_manager  s,    --i8G  mmGr.   c                    US LnU(       d  U R                  U5      $ [        U5      R                  nUS:H  =(       a     U R                  5       R	                  SS5      nU(       d  UR                  S5      (       a  U$ U R                  U5      $ )Nr   r   Fr   )r   r!   ru   r   rL   r   )ro   rw   r`   	has_proxyproxy_schemeusing_https_forwarding_proxys         r/   _get_request_target"URLLib3Session._get_request_target  s    T)	>>#&&
  	*11G# N$$&**+EuM 	%
 (3>>'+B+BJ>>#&&r.   c                 b    UR                  SS5      n[        U5      nUR                  5       S:H  $ )NzTransfer-Encodingr.   s   chunked)rL   r   rX   )ro   r~   transfer_encodings      r/   _chunkedURLLib3Session._chunked  s4    #KK(;SA():; &&(J66r.   c                     U R                   R                  5         U R                  R                  5        H  nUR                  5         M     g r+   )r   clearr   values)ro   r   s     r/   closeURLLib3Session.close  s4    ++224GMMO 5r.   c                 n    U R                   R                  UR                  5      nU R                  UR                  U5      nUR	                  UR                  5      nU R                  XAR                  U R                  5        [        [        R                  R                  SS5      5      (       a-  [        UR                  5      R                  nXTR                  S'   U R                  UR                  U5      nUR                  UR                   UUR"                  UR$                  ['        S5      SSSU R)                  UR$                  5      S9	n[*        R,                  R/                  UR                  UR0                  UR$                  U5      nUR2                  (       d  UR4                    U$ ! [6         a  n	[9        UR                  U	S9eS n	A	f[:        [<        R>                  4 a  n	[A        UR                  U	S9eS n	A	f[B         a  n	[E        [G        W5      U	S9eS n	A	f[H         a  n	[K        UR                  U	S9eS n	A	f[L         a  n	[O        UR                  U	S9eS n	A	f[P         a  n	[S        XUR                  S9eS n	A	f[T         a$  n	S	n
[V        RY                  U
S
S9  [[        U	S9eS n	A	ff = f)N(BOTO_EXPERIMENTAL__ADD_PROXY_HOST_HEADER rf   F)	methodrw   bodyr~   retriesassert_same_hostpreload_contentdecode_contentchunked)endpoint_urlr   )r`   r   )r   requestr  z4Exception received when sending urllib3 HTTP requestT)exc_infor   ).r   ry   rw   r   connection_from_urlr   r   rZ   rJ   rK   rL   r!   hostnamer   r  urlopenr  r  r~   r   r  r   r   AWSResponsestatusstream_outputcontentr   r   r	   socketgaierrorr#   r   r&   rc   URLLib3ConnectTimeoutErrorr   URLLib3ReadTimeoutErrorr   r
   r"   	Exceptionr1   r2   r$   )ro   r  r`   r   r   rf   request_targeturllib_responsehttp_responser   messages              r/   sendURLLib3Session.send  s?   =	+**88EI227;;	JG..w{{;D  {{DLLA

I2N   ,55-1""6*!55gkk9MN"ll~~"\\e!& %$goo6 + 
O %//;;&&''	M (( %%   	>1=="FOO4 	M)w{{!LL 	&(31  * 	I%7;;aHH& 	F"1EE 	'w{{   	+LGLL4L0!**	+s`   F.F1 1
J4;GJ4,H  J4H  J4-IJ4I""J4/JJ4J//J4)
r   r   r   r   r   r   r   r   r   r   r+   )r   r   r   r   r   MAX_POOL_CONNECTIONSrr   r   r   r   r   r   r   r   r   r  r  r  r*  r   r-   r.   r/   r   r     sb    	 1%LNJ
#(/ !54'(7

>+r.   r   )NNNN)MloggingrJ   os.pathr!  rF   warningsbase64r   urllib3r   r   r   urllib3.exceptionsr   r#  r   r	   r
   r   r   r$  r   r   urllib3.util.retryr   urllib3.util.ssl_r   r   r   r   r   r   urllib3.util.urlr   r   r   ImportErrorcatch_warningssimplefilterDeprecationWarningurllib3.contrib.pyopensslr   r   r   botocore.awsrequestr   botocore.compatr   r   r   r    r!   botocore.exceptionsr"   r#   r$   r%   r&   	getLoggerr   r1   r   r,  r   joindirname__file__r,   certifir)   r5   rS   rZ   rc   rg   ri   r   r-   r.   r/   <module>rC     s    	   
   8 8  K : $  '6C
- 
	 	 	"h1CD	
 
#1  	 	 	  			8	$ GGLL!:LI ! =AM`%$A
8 8vj+ j+c  6 656 
#	"  -,-
   O	B  !!!sf   $E -E0 >EE0 F F EE
E-)E0 -E0 0E?>E?FF	FF