3
Z'íc ã @ s d dl mZ d dlZd dlZd dlZd dlmZ ddlmZ ddl m
Z
ddlmZ ej
dd Zd
d Zdd
Zdd ZdddZdS )é )Úabsolute_importN)ÚBytesIOé )ÚRequestField)Úsix)Úbzutf-8é c C s$ t jtjd} tjs | jd} | S )zN
Our embarrassingly-simple replacement for mimetools.choose_boundary.
é Úascii)ÚbinasciiÚhexlifyÚosÚurandomr ÚPY2Údecode)Úboundary© r ú3/tmp/pip-build-gk9425m9/urllib3/urllib3/filepost.pyÚchoose_boundary s
r c c sN t | trtj| }nt| }x*|D ]"}t |tr:|V q$tj| V q$W dS )z
Iterate over fields.
Supports list of (k, v) tuples and dicts, and lists of
:class:`~urllib3.fields.RequestField`.
N)Ú
isinstanceÚdictr Ú iteritemsÚiterr Úfrom_tuples)ÚfieldsÚiÚfieldr r r Úiter_field_objects s
r c C s, t | trdd tj| D S dd | 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 | ]\}}||fV qd S )Nr )Ú.0ÚkÚvr r r ú <genexpr>: s ziter_fields.<locals>.<genexpr>c s s | ]\}}||fV qd S )Nr )r r r r r r r! <