%PDF- %PDF-
Direktori : /snap/core/17212/usr/lib/python3/dist-packages/urllib3/__pycache__/ |
Current File : //snap/core/17212/usr/lib/python3/dist-packages/urllib3/__pycache__/filepost.cpython-35.pyc |
Rg� � @ s� d d l m Z d d l Z d d l m Z d d l m Z d d l Z d d l m Z d d l m Z e j d � d Z d d � Z d d � Z d d � Z d d d � Z d S)� )�absolute_importN)�uuid4)�BytesIO)�b� )�RequestFieldzutf-8� c C s t � j S)zM Our embarassingly-simple replacement for mimetools.choose_boundary. )r �hex� r r �2/usr/lib/python3/dist-packages/urllib3/filepost.py�choose_boundary s r c c sg t | t � r! t j | � } n t | � } x3 | D]+ } t | t � rQ | Vq4 t j | � Vq4 Wd S)z� Iterate over fields. Supports list of (k, v) tuples and dicts, and lists of :class:`~urllib3.fields.RequestField`. N)� isinstance�dict�six� iteritems�iterr Zfrom_tuples)�fields�i�fieldr r r �iter_field_objects s r c C s: t | t � r) d d � t j | � D� Sd d � | D� S)a- .. deprecated:: 1.6 Iterate over fields. The addition of :class:`~urllib3.fields.RequestField` makes this function obsolete. Instead, use :func:`iter_field_objects`, which returns :class:`~urllib3.fields.RequestField` objects. Supports list of (k, v) tuples and dicts. c s s! | ] \ } } | | f Vq d S)Nr )�.0�k�vr r r � <genexpr>6 s ziter_fields.<locals>.<genexpr>c s s! | ] \ } } | | f Vq d S)Nr )r r r r r r r 8 s )r r r r )r r r r �iter_fields) s r c C s t � } | d k r t � } x� t | � D]� } | j t d | � � t | � j | j � � | j } t | t � r� t | � } t | t j � r� t | � j | � n | j | � | j d � q+ W| j t d | � � t d | � } | j � | f S)aJ 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`). :param boundary: If not specified, then a random boundary will be generated using :func:`mimetools.choose_boundary`. Nz--%s s z--%s-- z multipart/form-data; boundary=%s)r r r �writer �writerZrender_headers�datar �int�strr Z text_type�getvalue)r �boundaryZbodyr r Zcontent_typer r r �encode_multipart_formdata; s r"