관리-도구
편집 파일: filepost.cpython-311.pyc
� �܋f[ � � � d dl mZ d dlZd dlZd dlZd dlZd dlmZ ddlm Z m Z ej d� � d Zej ej ej ee f e f Zej eej ee f f Zdd �Zdd�Z ddd�ZdS )� )�annotationsN)�BytesIO� )�_TYPE_FIELD_VALUE_TUPLE�RequestFieldzutf-8� �return�strc �r � t j t j d� � � � � � � S )zN Our embarrassingly-simple replacement for mimetools.choose_boundary. � )�binascii�hexlify�os�urandom�decode� � �G/opt/cloudlinux/venv/lib64/python3.11/site-packages/urllib3/filepost.py�choose_boundaryr s) � � ��B�J�r�N�N�+�+�2�2�4�4�4r �fields�_TYPE_FIELDS�typing.Iterable[RequestField]c # �� K � t | t j � � r| � � � }n| }|D ],}t |t � � r|V � �t j |� V � �-dS )z� Iterate over fields. Supports list of (k, v) tuples and dicts, and lists of :class:`~urllib3.fields.RequestField`. N)� isinstance�typing�Mapping�itemsr �from_tuples)r �iterable�fields r �iter_field_objectsr! s} � � � � �&�&�.�)�)� ��<�<�>�>������ 3� 3���e�\�*�*� 3��K�K�K�K��*�E�2�2�2�2�2� 3� 3r �boundary� str | None�tuple[bytes, str]c �� � t � � }|�t � � }t | � � D ]�}|� d|� d�� d� � � � t |� � � |� � � � � |j }t |t � � rt |� � }t |t � � r#t |� � � |� � n|� |� � |� d� � ��|� d|� d�� d� � � � d|� �}|� � � |fS )a� Encode a dictionary of ``fields`` using the multipart/form-data MIME format. :param fields: Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`). Values are processed by :func:`urllib3.fields.RequestField.from_tuples`. :param boundary: If not specified, then a random boundary will be generated using :func:`urllib3.filepost.choose_boundary`. Nz--z zlatin-1s z-- zmultipart/form-data; boundary=)r r r! �write�encode�writer�render_headers�datar �intr �getvalue)r r"