HEX
Server: Apache
System: Linux vps35971 6.8.0-79-generic #79~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 15 16:54:53 UTC 2 x86_64
User: haitiopendh (6209306)
PHP: 8.1.32
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/botocore/__pycache__/endpoint.cpython-310.pyc
o

YZ�a�5�@s�ddlZddlZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZm
Z
mZddlmZddlmZddlmZdd	lmZe�e�Ze�Zd
ZdZdd
�ZGdd�de�ZGdd�de�Z dS)�N)�create_request_object)�HTTPClientError)�URLLib3Session)�is_valid_endpoint_url�is_valid_ipv6_endpoint_url�get_environ_proxies)�first_non_none_response)�get_global_history_recorder)�
StreamingBody)�parsers�<�
cCsz|j|jd|jid�}|ddkr|j|d<|S|jr"|j|d<|S|jr6|d�d�}t|j|�|d<|S|j|d<|S)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�,�bodyrzcontent-length)	rr�name�content�has_event_stream_output�raw�has_streaming_output�getr
)�
http_response�operation_model�
response_dict�length�r�3/usr/lib/python3/dist-packages/botocore/endpoint.py�convert_to_response_dict(s"��
�
�
�r c@szeZdZdZ	ddd�Zdd�Zdd�Zdd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
	ddd�Zdd�ZdS)�Endpointa,
    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.
    NcCsR||_||_||_t��|_|durt��}||_||_	|j	dur't
�|_	dSdS�N)�_endpoint_prefix�_event_emitter�host�	threading�Lock�_lockr�ResponseParserFactory�_response_parser_factory�http_sessionr)�selfr%�endpoint_prefix�
event_emitter�response_parser_factoryr+rrr�__init__Us

�zEndpoint.__init__cCsd|j|jfS)Nz%s(%s))r#r%)r,rrr�__repr__bszEndpoint.__repr__cCst�d||�|�||�S)Nz%Making request for %s with params: %s)�logger�debug�
_send_request)r,r�request_dictrrr�make_requestes�zEndpoint.make_requestcCs\t|�}|r't|j|jg�|_|jj��}dj||j	d�}|j
j|||j	d�|�|�}|S)Nz&request-created.{service_id}.{op_name})�
service_id�op_name)�requestr)
r�anyrr�
stream_output�
service_modelr7�	hyphenize�formatrr$�emit�prepare_request)r,�paramsrr9r7�
event_name�prepared_requestrrr�create_requestjs ��
�
zEndpoint.create_requestcCs0|��D]\}}t|tj�r|�d�||<qdS)Nzutf-8)�items�
isinstance�six�	text_type�encode)r,r�key�valuerrr�_encode_headerszs
��zEndpoint._encode_headerscCs|�|j�|��Sr")rLr�prepare�r,r9rrrr@�szEndpoint.prepare_requestc	Cs�d}|�||�}|d}|�|||�\}}|�|||||�r>|d7}|��|�||�}|�|||�\}}|�|||||�s|durTd|dvrT|d}||ddd<|durZ|�|S)N�r�ResponseMetadata�
RetryAttempts)rD�
_get_response�_needs_retry�reset_stream)	r,r5r�attemptsr9r�success_response�	exception�
total_retriesrrrr4�s6�
���
��
zEndpoint._send_requestc
Csv|�||�\}}dd||d�}|dur"|\}}||d<t||�|d<|jj��}	|jjd|	|jffi|��||fS)N)r�parsed_responserrWrYrzresponse-received.%s.%s)�_do_get_responser r<r7r=r$r?r)
r,r9rrrVrW�kwargs_to_emitrrYr7rrrrR�s.������zEndpoint._get_responsec

CsZz;t�d|�t�d|j|j|j|j|jd��|j	j
��}d||jf}|j
j||d�}t|�}|dur:|�|�}Wn2tyQ}z
d|fWYd}~Sd}~wtym}ztjddd�d|fWYd}~Sd}~wwt||�}|��}	|j|	d	<t�d
|	�|jd}
|j�|
�}|�||j�}|jdkr�|�||||�t�d
|�||fdfS)NzSending http request: %s�HTTP_REQUEST)�methodr�	streaming�urlrzbefore-send.%s.%s)r9z-Exception received when sending HTTP request.T)�exc_infor^�
HTTP_RESPONSE�protocolr�PARSED_RESPONSE)r2r3�history_recorder�recordr]r�has_streaming_inputr_rr<r7r=rr$r?r�_sendr�	Exceptionr �copyr�metadatar*�
create_parser�parse�output_shaper�_add_modeled_error_fields)
r,r9rr7rB�	responsesr�er�http_response_record_dictrb�parserrYrrrrZ�sV�
�����
�
�
�zEndpoint._do_get_responsec	CsT|�di��d�}|durdS|j}|�|�}|durdS|�||�}|�|�dS)N�Error�Code)rr<�shape_for_error_coderl�update)	r,rrYrrr�
error_coder<�error_shape�
modeled_parserrrrn�s
z"Endpoint._add_modeled_error_fieldsc
	Csb|jj��}d||jf}|jj|||||||d�}t|�}	|	dur$dSt�d|	�t	�
|	�dS)Nzneeds-retry.%s.%s)�response�endpoint�	operationrU�caught_exceptionr5Fz3Response received to retry, sleeping for %s secondsT)r<r7r=rr$r?rr2r3�time�sleep)
r,rUrr5rzr}r7rBro�handler_responserrrrS�s$���
zEndpoint._needs_retrycCs|j�|�Sr")r+�sendrNrrrrg
szEndpoint._send)NNr")�__name__�
__module__�__qualname__�__doc__r0r1r6rDrLr@r4rRrZrnrSrgrrrrr!Ks 

�

/
�r!c	@s@eZdZdd�Zddeeeddddf	dd�Zdd�Zdd	�Z	dS)
�EndpointCreatorcCs
||_dSr")r$)r,r.rrrr0s
zEndpointCreator.__init__Nc
	Csrt|�st|�std|��|	dur|�|�}	|j}
t�d|
|�|||	|�|�||
||d�}t||
|j	||d�S)NzInvalid endpoint: %szSetting %s timeout as %s)�timeout�proxies�verify�max_pool_connections�socket_options�client_cert�proxies_config)r-r.r/r+)
rr�
ValueError�_get_proxiesr-r2r3�_get_verify_valuer!r$)r,r<�region_name�endpoint_urlr�r/r�r��http_session_clsr�r�r�r�r-r+rrr�create_endpoints2��
�
�zEndpointCreator.create_endpointcCst|�Sr")r)r,r_rrrr�9szEndpointCreator._get_proxiescCs|dur|Stj�dd�S)N�REQUESTS_CA_BUNDLET)�os�environr)r,r�rrrr�>sz!EndpointCreator._get_verify_value)
r�r�r�r0�DEFAULT_TIMEOUT�MAX_POOL_CONNECTIONSrr�r�r�rrrrr�s
�$r�)!r��loggingr~r&rG�botocore.awsrequestr�botocore.exceptionsr�botocore.httpsessionr�botocore.utilsrrr�botocore.hooksr�botocore.historyr	�botocore.responser
�botocorer�	getLoggerr�r2rdr�r�r �objectr!r�rrrr�<module>s*
#G