Server : nginx/1.24.0 System : Linux ip-172-31-33-48 6.14.0-1011-aws #11~24.04.1-Ubuntu SMP Fri Aug 1 02:07:25 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE Directory : /lib/python3/dist-packages/botocore/__pycache__/ |
Upload File : |
� P��eb� � �Z � d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z ddl mZ ddlm Z ddlmZmZmZmZ dZd Zd Z ej, d� Zdd�Z G d � d� Z G d� de� Z G d� de� Z G d� de� Z G d� de� Z G d� dee� Z G d� de� Zeeeeed�Z y)a� Protocol input serializes. This module contains classes that implement input serialization for the various AWS protocol types. These classes essentially take user input, a model object that represents what the expected input should look like, and it returns a dictionary that contains the various parts of a request. A few high level design decisions: * Each protocol type maps to a separate class, all inherit from ``Serializer``. * The return value for ``serialize_to_request`` (the main entry point) returns a dictionary that represents a request. This will have keys like ``url_path``, ``query_string``, etc. This is done so that it's a) easy to test and b) not tied to a particular HTTP library. See the ``serialize_to_request`` docstring for more details. Unicode ------- The input to the serializers should be text (str/unicode), not bytes, with the exception of blob types. Those are assumed to be binary, and if a str/unicode type is passed in, it will be encoded as utf-8. � N)�ElementTree)�validate)� formatdate)�ParamValidationError)� has_header�is_json_value_header�parse_to_aware_datetime�percent_encode�iso8601z%Y-%m-%dT%H:%M:%SZz%Y-%m-%dT%H:%M:%S.%fZz^[A-Za-z0-9\.\-]+$c �x � t | � }|r*t j � }t j ||� }|S �N)�SERIALIZERSr �ParamValidator�ParamValidationDecorator)� protocol_name�include_validation� serializer� validators �4/usr/lib/python3/dist-packages/botocore/serialize.py�create_serializerr A s8 � ��]�+�-�J���+�+�-� ��6�6�y�*�M� ��� c �P � e Zd ZdZeZdZd� Zd� Zd� Z d� Z d� Zd d �Zd � Z d� Zd� Zy)� Serializer�POSTzutf-8c � � t d� �)a� Serialize parameters into an HTTP request. This method takes user provided parameters and a shape model and serializes the parameters to an HTTP request. More specifically, this method returns information about parts of the HTTP request, it does not enforce a particular interface or standard for an HTTP request. It instead returns a dictionary of: * 'url_path' * 'host_prefix' * 'query_string' * 'headers' * 'body' * 'method' It is then up to consumers to decide how to map this to a Request object of their HTTP library of choice. Below is an example return value:: {'body': {'Action': 'OperationName', 'Bar': 'val2', 'Foo': 'val1', 'Version': '2014-01-01'}, 'headers': {}, 'method': 'POST', 'query_string': '', 'host_prefix': 'value.', 'url_path': '/'} :param parameters: The dictionary input parameters for the operation (i.e the user input). :param operation_model: The OperationModel object that describes the operation. �serialize_to_request��NotImplementedError)�self� parameters�operation_models r r zSerializer.serialize_to_requestS s � �H "�"8�9�9r c �* � dd| j i dd�}|S )N�/� r )�url_path�query_string�method�headers�body)�DEFAULT_METHOD)r � serializeds r �_create_default_requestz"Serializer._create_default_requesty s( � � ���)�)��� � � �r c �\ � |j dkD rt }nt }|j |� S )Nr )�microsecond� ISO8601_MICRO�ISO8601�strftime)r �value�timestamp_formats r �_timestamp_iso8601zSerializer._timestamp_iso8601� s, � ����q� �,��&���~�~�.�/�/r c �Z � t t j |j � � � S r )�int�calendar�timegm� timetuple�r r2 s r �_timestamp_unixtimestampz#Serializer._timestamp_unixtimestamp� s � ��8�?�?�5�?�?�#4�5�6�6r c �r � t |t j � r| j |� }t |d�� S )NT)�usegmt)� isinstance�datetimer; r r: s r �_timestamp_rfc822zSerializer._timestamp_rfc822� s/ � ��e�X�.�.�/��1�1�%�8�E��%��-�-r Nc � � |�| j }|j � }t |� }t | d|� �� } ||� }|S )N�_timestamp_)�TIMESTAMP_FORMAT�lowerr �getattr)r r2 r3 �datetime_obj� converter�final_values r �_convert_timestamp_to_strz$Serializer._convert_timestamp_to_str� sR � ��#�#�4�4��+�1�1�3��.�u�5���D�K�0@�/A�"B�C� ���-���r c �: � |j j d|� S �N�name�� serialization�get)r �shape�default_names r �_get_serialized_namezSerializer._get_serialized_name� s � � �"�"�&�&�v�|�<�<r c �� � t |t � r|j | j � }t j |� j � j | j � S r )r>