403Webshell
Server IP : 93.115.150.27  /  Your IP : 216.73.216.221
Web Server : LiteSpeed
System : Linux host2.azar.host 4.18.0-553.80.1.lve.el8.x86_64 #1 SMP Wed Oct 22 19:29:36 UTC 2025 x86_64
User : dorfakkh ( 1797)
PHP Version : 8.1.34
Disable Function : show_source, system, passthru, exec, popen, proc_open, mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3.6/site-packages/requests_toolbelt/utils/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.6/site-packages/requests_toolbelt/utils/__pycache__/formdata.cpython-36.pyc
3

�P\��@sDdZddlmZddlmZd
Zdd�Zdd�Zdd	�Zd
d�ZdS)z8Implementation of nested form-data encoding function(s).�)�
basestring)�	urlencodercsdtttf�t|�}tdd�|D��s,td��|}x"t�fdd�|D��rRt|�}q2Wt|f|�|�S)aTHandle nested form-data queries and serialize them appropriately.

    There are times when a website expects a nested form data query to be sent
    but, the standard library's urlencode function does not appropriately
    handle the nested structures. In that case, you need this function which
    will flatten the structure first and then properly encode it for you.

    When using this to send data in the body of a request, make sure you
    specify the appropriate Content-Type header for the request.

    .. code-block:: python

        import requests
        from requests_toolbelt.utils import formdata

        query = {
           'my_dict': {
               'foo': 'bar',
               'biz': 'baz",
            },
            'a': 'b',
        }

        resp = requests.get(url, params=formdata.urlencode(query))
        # or
        resp = requests.post(
            url,
            data=formdata.urlencode(query),
            headers={
                'Content-Type': 'application/x-www-form-urlencoded'
            },
        )

    Similarly, you can specify a list of nested tuples, e.g.,

    .. code-block:: python

        import requests
        from requests_toolbelt.utils import formdata

        query = [
            ('my_list', [
                ('foo', 'bar'),
                ('biz', 'baz'),
            ]),
            ('a', 'b'),
        ]

        resp = requests.get(url, params=formdata.urlencode(query))
        # or
        resp = requests.post(
            url,
            data=formdata.urlencode(query),
            headers={
                'Content-Type': 'application/x-www-form-urlencoded'
            },
        )

    For additional parameter and return information, see the official
    `urlencode`_ documentation.

    .. _urlencode:
        https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlencode
    css|]}t|�VqdS)N)�
_is_two_tuple)�.0�i�r�/usr/lib/python3.6/formdata.py�	<genexpr>Nszurlencode.<locals>.<genexpr>zQExpected query to be able to be converted to a list comprised of length 2 tuples.c3s|]\}}t|��VqdS)N)�
isinstance)r�_�v)�expand_classesrrr	Ss)	�dict�list�tuple�_to_kv_list�all�
ValueError�any�_expand_query_values�
_urlencode)Zquery�args�kwargs�original_query_list�
query_listr)r
rr
sA
cCst|d�rt|j��S|S)N�items)�hasattrrr)Zdict_or_listrrrrYs
rcCst|ttf�ot|�dkS)Nr)r
rr�len)�itemrrrr_srcs\g}xR|D]J\}}t|t�r,|j||f�q
|d�t|�}|j�fdd�|D��q
W|S)Nz[%s]c3s|]\}}�||fVqdS)Nr)r�kr)�key_fmtrrr	ksz'_expand_query_values.<locals>.<genexpr>)r
r�appendr�extend)rr�key�valueZ
value_listr)r rrcs
rN)r)	�__doc__Z_compatrrr�__all__rrrrrrr�<module>sO

Youez - 2016 - github.com/yon3zu
LinuXploit