
    vKgPA                        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	  S SK
Jr  S SKJr  S SK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  \R4                  " \5      r\" 5       rSrSrS r  " S S5      r! " S S5      r"g)    N)parsers)create_request_object)HTTPClientError)get_global_history_recorder)first_non_none_response)handle_checksum_body)URLLib3Session)StreamingBody)get_environ_proxiesis_valid_endpoint_urlis_valid_ipv6_endpoint_url<   
   c                 h   U R                   U R                  SUR                  0S.nUS   S:  a  U R                  US'   U$ UR                  (       a  U R
                  US'   U$ UR                  (       a/  US   R                  S5      n[        U R
                  U5      US'   U$ U R                  US'   U$ )a  Convert an HTTP response object to a request dict.

This converts the requests library's HTTP response object to
a dictionary.

:type http_response: botocore.vendored.requests.model.Response
:param http_response: The HTTP response from an AWS service request.

:rtype: dict
:return: A response dictionary which will contain the following keys:
    * headers (dict)
    * status_code (int)
    * body (string or file-like object)

operation_name)headersstatus_codecontextr   ,  bodyr   zcontent-length)	r   r   namecontenthas_event_stream_outputrawhas_streaming_outputgetr
   )http_responseoperation_modelresponse_dictlengths       Q/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/botocore/endpoint.pyconvert_to_response_dictr"   *   s    " !(($00o22
M ]#s* - 5 5f  
	0	0 - 1 1f  
	-	-y)--.>? -m.?.? Hf  !. 5 5f    c                       \ rS rSrSr  SS jrS rS rS rSS jr	S	 r
S
 rS rS rSS jrS rS rS rS r  SS jrS rSrg)EndpointM   a  
Represents an endpoint for a particular service in a specific
region.  Only an endpoint can make requests.

:ivar service: The Service object that describes this endpoints
    service.
:ivar host: The fully qualified endpoint hostname.
:ivar session: The session object.
Nc                     X l         X0l        Xl        [        R                  " 5       U l        Uc  [        R                  " 5       nX@l        XPl	        U R                  c  [        5       U l	        g g N)_endpoint_prefix_event_emitterhost	threadingLock_lockr   ResponseParserFactory_response_parser_factoryhttp_sessionr	   )selfr+   endpoint_prefixevent_emitterresponse_parser_factoryr1   s         r!   __init__Endpoint.__init__X   s`     !0+	^^%
"*&-&C&C&E#(?%($ . 0D %r#   c                 :    U R                    SU R                   S3$ )N())r)   r+   r2   s    r!   __repr__Endpoint.__repr__k   s     ''($))A66r#   c                 8    U R                   R                  5         g r(   )r1   closer;   s    r!   r?   Endpoint.closen   s    !r#   c                 R    [         R                  SUU5        U R                  X!5      $ )Nz%Making request for %s with params: %s)loggerdebug_send_request)r2   r   request_dicts      r!   make_requestEndpoint.make_requestq   s*    3	

 !!,@@r#   c                 N   [        U5      nU(       a  [        UR                  UR                  /5      Ul        UR
                  R                  R                  5       nSU SUR                   3nU R                  R                  UUUR                  S9  U R                  U5      nU$ )Nzrequest-created..)requestr   )r   anyr   r   stream_outputservice_model
service_id	hyphenizer   r*   emitprepare_request)r2   paramsr   rJ   rN   
event_nameprepared_requests          r!   create_requestEndpoint.create_requesty   s    '/$'#88#;;%G! )66AAKKMJ+J<q9M9M8NOJ$$.33 % 
  //8r#   c                     UR                  5        H/  u  p#[        U[        5      (       d  M  UR                  S5      X'   M1     g )Nzutf-8)items
isinstancestrencode)r2   r   keyvalues       r!   _encode_headersEndpoint._encode_headers   s1    !--/JC%%%$||G4 *r#   c                 X    U R                  UR                  5        UR                  5       $ r(   )r^   r   preparer2   rJ   s     r!   rQ   Endpoint.prepare_request   s!    W__-  r#   c                     [         R                   R                  5       n[         R                   R                  US5      nXQ-
  nU[         R                  " US9-   U-   nUR	                  S5      $ )Nz%a, %d %b %Y %H:%M:%S %Z)secondsz%Y%m%dT%H%M%SZ)datetimeutcnowstrptime	timedeltastrftime)r2   response_received_timestampdate_headerread_timeoutlocal_timestampdate_conversionestimated_skewttls           r!   _calculate_ttlEndpoint._calculate_ttl   ss     #++224"++443
 )F  67 	
 ||,--r#   c                 4   US   R                   R                  S5      nUR                  S5      nU(       a>  U(       d6   [        R                  R                  5       nU R	                  UUU5      US'   g g g ! [
         a    [        R                  SSS9   g f = f)Nr   Datehas_streaming_inputrq   z9Exception received when updating retries context with TTLTexc_info)r   r   rf   rg   rr   	ExceptionrB   rC   )r2   retries_contextrm   success_responseresponse_date_headerrv   rk   s          r!   _set_ttlEndpoint._set_ttl   s    /2::>>vF-112GH(;.6.?.?.F.F.H+)-)<)</( *& )<  O!  s   4A6 6BBc                     UR                  S0 5      nX$S'   SU;  a!  [        [        R                  " 5       5      US'   U(       a"  US   R                  nU R                  XEU5        g g )Nretriesattemptzinvocation-idclient_config)
setdefaultrZ   uuiduuid4rm   r}   )r2   r   r   r{   rz   rm   s         r!   _update_retries_context Endpoint._update_retries_context   s`    !,,Y;%,	"/1/24::</@OO,"?3@@LMM/9IJ r#   c                    SnUS   nU R                  XC5        U R                  X5      nU R                  XRU5      u  pgU R                  UUUUU5      (       ah  US-  nU R                  XCU5        UR	                  5         U R                  X5      nU R                  XRU5      u  pgU R                  UUUUU5      (       a  Mh  Ub  SUS   ;   a  US-
  nUUS   S   S'   Ub  UeU$ )N   r   ResponseMetadataRetryAttempts)r   rU   _get_response_needs_retryreset_stream)	r2   rE   r   attemptsr   rJ   r{   	exceptiontotal_retriess	            r!   rD   Endpoint._send_request   s/   y)$$W7%%lD&*&8&8g'
# 
 
 MH((<LM
   ")),HG*.*<*<'+'! 
 
( ("&6q&99 %qLM Q 23OD  O##r#   c                    U R                  XU5      u  pES S UUS.nUb  Uu  pxXS'   [        Xr5      US'   UR                  R                  R	                  5       n	U R
                  R                  " SU	 SUR                   340 UD6  XE4$ )N)r   parsed_responser   r   r   r   zresponse-received.rI   )_do_get_responser"   rM   rN   rO   r*   rP   r   )
r2   rJ   r   r   r{   r   kwargs_to_emitr   r   rN   s
             r!   r   Endpoint._get_response   s     '+&;&;g'
# "#"	
 '-=*M0?,-.F/N?+ %22==GGI
   Ao.B.B-CD	
	
  **r#   c           	      T    [         R                  SU5        [        R                  SUR                  UR
                  UR                  UR                  UR                  S.5        UR                  R                  R                  5       nSU SUR                   3nU R                  R                  XQS9n[        U5      nUc  U R!                  U5      n['        Xr5      n	[)        UU	UU5        U	R+                  5       n
UR,                  U
S
'   [        R                  SU
5        UR.                  S   n0 nU R                  R                  SU SUR                   3UU	US9  U R0                  R3                  U5      nUR5                  XR6                  5      nUR9                  U5        UR:                  S:  a  U R=                  U	UUU5        [        R                  SU5        X~4S 4$ ! ["         a  nS U4s S nA$ S nAf[$         a"  n[         R                  SSS	9  S U4s S nA$ S nAff = f)NzSending http request: %sHTTP_REQUEST)methodr   	streamingurlr   zbefore-send.rI   )rJ   z-Exception received when sending HTTP request.Trw   r   HTTP_RESPONSEprotocolzbefore-parse.)r   r   customized_response_dictr   PARSED_RESPONSE)rB   rC   history_recorderrecordr   r   rv   r   r   rM   rN   rO   r   r*   rP   r   _sendr   ry   r"   r   copyr   metadatar0   create_parserparseoutput_shapeupdater   _add_modeled_error_fields)r2   rJ   r   r   rN   rS   	responsesr   er   http_response_record_dictr   r   parserr   s                  r!   r   Endpoint._do_get_response  s;   	LL3W=##%nn&!0!D!D";;#LL	 )66AAKKMJ'
|1_5I5I4JKJ++000MI3I>M$ $

7 3 1
 			
 %2$6$6$8!00 	"+. 	1JK"++J7#%   J<q)=)=(>?+'%=	 	! 	
 ..<<XF ,,77
 	78 $$+**	 	 1?C/55e  	!9 	LL?$   !9		s0   CG% %
H'/G82H'8H'H"H'"H'c                     UR                  S0 5      R                  S5      nUc  g UR                  nUR                  U5      nUc  g UR                  X5      nUR	                  U5        g )NErrorCode)r   rM   shape_for_error_coder   r   )	r2   r   r   r   r   
error_coderM   error_shapemodeled_parses	            r!   r   "Endpoint._add_modeled_error_fieldsL  sj     %(("599&A
'55#88D]@}-r#   c           
      $   UR                   R                  R                  5       nSU SUR                   3nU R                  R                  UUU UUUUS9n[        U5      n	U	c  g[        R                  SU	5        [        R                  " U	5        g)Nzneeds-retry.rI   )responseendpoint	operationr   caught_exceptionrE   Fz3Response received to retry, sleeping for %s secondsT)rM   rN   rO   r   r*   rP   r   rB   rC   timesleep)
r2   r   r   rE   r   r   rN   rS   r   handler_responses
             r!   r   Endpoint._needs_retry^  s     %22==GGI
#J<q1E1E0FG
'',,%-% - 
	 39=# LLE  JJ'(r#   c                 8    U R                   R                  U5      $ r(   )r1   sendrb   s     r!   r   Endpoint._send~  s      %%g..r#   )r)   r*   r.   r0   r+   r1   )NNr(   )__name__
__module____qualname____firstlineno____doc__r6   r<   r?   rF   rU   r^   rQ   rr   r}   r   rD   r   r   r   r   r   __static_attributes__ r#   r!   r%   r%   M   sm     !%1&7"A &5!."K'$R+8E6N.. @/r#   r%   c            	       B    \ rS rSrS rSS\\\SSSS4	S jrS r	S r
Srg)EndpointCreatori  c                     Xl         g r(   r*   )r2   r4   s     r!   r6   EndpointCreator.__init__  s    +r#   Nc           
      .   [        U5      (       d  [        U5      (       d  [        SU 35      eU	c  U R                  U5      n	UR                  n[
        R                  SX5        U" UU	U R                  U5      UU
UUS9n[        UUU R                  UUS9$ )NzInvalid endpoint: zSetting %s timeout as %s)timeoutproxiesverifymax_pool_connectionssocket_optionsclient_certproxies_config)r3   r4   r5   r1   )
r   r   
ValueError_get_proxiesr3   rB   rC   _get_verify_valuer%   r*   )r2   rM   region_nameendpoint_urlr   r5   r   r   http_session_clsr   r   r   r   r3   r1   s                  r!   create_endpointEndpointCreator.create_endpoint  s     %
 
,\::1,@AA?''5G'77/J'))&1!5)#)
 +--$;%
 	
r#   c                     [        U5      $ r(   )r   )r2   r   s     r!   r   EndpointCreator._get_proxies  s     #3''r#   c                 L    Ub  U$ [         R                  R                  SS5      $ )NREQUESTS_CA_BUNDLET)osenvironr   )r2   r   s     r!   r   !EndpointCreator._get_verify_value  s'     M zz~~2D99r#   r   )r   r   r   r   r6   DEFAULT_TIMEOUTMAX_POOL_CONNECTIONSr	   r   r   r   r   r   r#   r!   r   r     s4    ,  $1')
V(
:r#   r   )#rf   loggingr   r,   r   r   botocorer   botocore.awsrequestr   botocore.exceptionsr   botocore.historyr   botocore.hooksr   botocore.httpchecksumr   botocore.httpsessionr	   botocore.responser
   botocore.utilsr   r   r   	getLoggerr   rB   r   r   r   r"   r%   r   r   r#   r!   <module>r      s~      	     5 / 8 2 6 / +  
		8	$.0   Fr/ r/j	?: ?:r#   