$56 GRAYBYTE WORDPRESS FILE MANAGER $57

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/lib/python2.7/site-packages/pip/_vendor/urllib3/

HOME
Current File : /lib/python2.7/site-packages/pip/_vendor/urllib3//filepost.py
from __future__ import absolute_import
import codecs

from uuid import uuid4
from io import BytesIO

from .packages import six
from .packages.six import b
from .fields import RequestField

writer = codecs.lookup('utf-8')[3]


def choose_boundary():
    """
    Our embarrassingly-simple replacement for mimetools.choose_boundary.
    """
    return uuid4().hex


def iter_field_objects(fields):
    """
    Iterate over fields.

    Supports list of (k, v) tuples and dicts, and lists of
    :class:`~urllib3.fields.RequestField`.

    """
    if isinstance(fields, dict):
        i = six.iteritems(fields)
    else:
        i = iter(fields)

    for field in i:
        if isinstance(field, RequestField):
            yield field
        else:
            yield RequestField.from_tuples(*field)


def iter_fields(fields):
    """
    .. 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.
    """
    if isinstance(fields, dict):
        return ((k, v) for k, v in six.iteritems(fields))

    return ((k, v) for k, v in fields)


def encode_multipart_formdata(fields, boundary=None):
    """
    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`.
    """
    body = BytesIO()
    if boundary is None:
        boundary = choose_boundary()

    for field in iter_field_objects(fields):
        body.write(b('--%s\r\n' % (boundary)))

        writer(body).write(field.render_headers())
        data = field.data

        if isinstance(data, int):
            data = str(data)  # Backwards compatibility

        if isinstance(data, six.text_type):
            writer(body).write(data)
        else:
            body.write(data)

        body.write(b'\r\n')

    body.write(b('--%s--\r\n' % (boundary)))

    content_type = str('multipart/form-data; boundary=%s' % boundary)

    return body.getvalue(), content_type


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
3 Mar 2024 8.23 PM
root / root
0755
contrib
--
3 Mar 2024 8.23 PM
root / root
0755
packages
--
3 Mar 2024 8.23 PM
root / root
0755
util
--
3 Mar 2024 8.23 PM
root / root
0755
__init__.py
2.786 KB
21 Apr 2022 6.08 PM
root / root
0644
__init__.pyc
3.024 KB
21 Apr 2022 6.08 PM
root / root
0644
__init__.pyo
3.024 KB
21 Apr 2022 6.08 PM
root / root
0644
_collections.py
9.965 KB
21 Apr 2022 6.08 PM
root / root
0644
_collections.pyc
12.886 KB
21 Apr 2022 6.08 PM
root / root
0644
_collections.pyo
12.886 KB
21 Apr 2022 6.08 PM
root / root
0644
connection.py
12.698 KB
21 Apr 2022 6.08 PM
root / root
0644
connection.pyc
10.602 KB
21 Apr 2022 6.08 PM
root / root
0644
connection.pyo
10.602 KB
21 Apr 2022 6.08 PM
root / root
0644
connectionpool.py
34.529 KB
21 Apr 2022 6.08 PM
root / root
0644
connectionpool.pyc
26.603 KB
21 Apr 2022 6.08 PM
root / root
0644
connectionpool.pyo
26.603 KB
21 Apr 2022 6.08 PM
root / root
0644
exceptions.py
6.448 KB
21 Apr 2022 6.08 PM
root / root
0644
exceptions.pyc
13.026 KB
21 Apr 2022 6.08 PM
root / root
0644
exceptions.pyo
13.026 KB
21 Apr 2022 6.08 PM
root / root
0644
fields.py
5.804 KB
21 Apr 2022 6.08 PM
root / root
0644
fields.pyc
6.669 KB
21 Apr 2022 6.08 PM
root / root
0644
fields.pyo
6.669 KB
21 Apr 2022 6.08 PM
root / root
0644
filepost.py
2.267 KB
21 Apr 2022 6.08 PM
root / root
0644
filepost.pyc
3.249 KB
21 Apr 2022 6.08 PM
root / root
0644
filepost.pyo
3.249 KB
21 Apr 2022 6.08 PM
root / root
0644
poolmanager.py
16.426 KB
21 Apr 2022 6.08 PM
root / root
0644
poolmanager.pyc
14.7 KB
21 Apr 2022 6.08 PM
root / root
0644
poolmanager.pyo
14.7 KB
21 Apr 2022 6.08 PM
root / root
0644
request.py
5.807 KB
21 Apr 2022 6.08 PM
root / root
0644
request.pyc
5.955 KB
21 Apr 2022 6.08 PM
root / root
0644
request.pyo
5.955 KB
21 Apr 2022 6.08 PM
root / root
0644
response.py
22.366 KB
21 Apr 2022 6.08 PM
root / root
0644
response.pyc
19.129 KB
21 Apr 2022 6.08 PM
root / root
0644
response.pyo
19.129 KB
21 Apr 2022 6.08 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF