AlkantarClanX12

Your IP : 18.117.145.67


Current Path : /opt/imunify360/venv/lib64/python3.11/site-packages/requests/__pycache__/
Upload File :
Current File : //opt/imunify360/venv/lib64/python3.11/site-packages/requests/__pycache__/utils.cpython-311.pyc

�

k��f�z���dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZddlmZddlmZddlmZdd	lmZdd
lmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%ddl&m'Z'ddl(m)Z)dd
l*m+Z+m,Z,m-Z-m.Z.dZ/ej0��Z1ddd�Z2d�3ej4ded���d����Z5ej6dkrd�Z7d�Zd�Z8d�Z9dId�Z:d�Z;d�Z<ej=d ���Z>d!�Z?d"�Z@d#�ZAd$�ZBdId%�ZCd&�ZDd'�ZEd(�ZFd)�ZGd*�ZHd+�ZId,�ZJd-�ZKeLd.��ZMd/�ZNd0�ZOd1�ZPd2�ZQd3�ZRd4�ZSej=d5���ZTd6�ZUdJd7�ZVd8�ZWdKd:�ZXd;�ZYd<�ZZd=�[d>��Z\e\d?zZ]e\d@zZ^dA�Z_dB�Z`dC�ZaejbdD��ZcejbdE��ZddF�ZedG�ZfdH�ZgdS)Lz�
requests.utils
~~~~~~~~~~~~~~

This module provides utility functions that are used within Requests
that are also useful for external consumption.
�N)�OrderedDict)�make_headers���__version__)�certs)�to_native_string)�parse_http_list)�quote�urlparse�bytes�str�unquote�
getproxies�proxy_bypass�
urlunparse�
basestring�
integer_types�is_py3�proxy_bypass_environment�getproxies_environment�Mapping��cookiejar_from_dict)�CaseInsensitiveDict)�
InvalidURL�
InvalidHeader�FileModeWarning�UnrewindableBodyError)z.netrc�_netrc�Pi�)�http�httpsz, z,\s*T)�accept_encodingzaccept-encoding�win32c�V�	trddl}nddl}n#t$rYdSwxYw	|�|jd��}t
|�|d��d��}|�|d��d}n#t$rYdSwxYw|r|sdS|�	d��}|D]t}|dkrd|vrd	S|�
dd
��}|�
dd��}|�
d
d��}tj||tj
��rd	S�udS)NrFz;Software\Microsoft\Windows\CurrentVersion\Internet Settings�ProxyEnable�
ProxyOverride�;z<local>�.Tz\.�*z.*�?)r�winreg�_winreg�ImportError�OpenKey�HKEY_CURRENT_USER�int�QueryValueEx�OSError�split�replace�re�match�I)�hostr-�internetSettings�proxyEnable�
proxyOverride�tests      �n/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/requests/utils.py�proxy_bypass_registryr@6s���	��
)��
�
�
�
�(�(�(�(����	�	�	��5�5�	����
	�%�~�~�f�.F�N� P� P���f�1�1�2B�.;�=�=�=>�@�A�A�K�#�/�/�0@�0?�A�A�AB�D�M�M���	�	�	��5�5�	�����	�-�	��5�
&�+�+�C�0�0�
�!�	�	�D��y� � ��d�?�?��4�4��<�<��U�+�+�D��<�<��U�+�+�D��<�<��T�*�*�D��x��d�B�D�)�)�
��t�t�
��us��
!�!�A B�
B�Bc�Z�t��rt|��St|��S)z�Return True, if the host should be bypassed.

        Checks proxy settings gathered from the environment, if specified,
        or the registry.
        )rrr@)r:s r?rr]s.��"�#�#�	/�+�D�1�1�1�(��.�.�.�c�N�t|d��r|���}|S)z/Returns an internal sequence dictionary update.�items)�hasattrrD)�ds r?�dict_to_sequencerGis(���q�'����
�G�G�I�I���HrBc���d}d}t|d��rt|��}n�t|d��r|j}nwt|d��rg	|���}tj|��j}d|jvrtjdt��n#tj$rYnwxYwt|d��r�	|���}t|d��r^|�\	|�
dd	��|���}|�
|pd��n5#ttf$rd}Yn wxYwn#ttf$r|�|}YnwxYw|�d}t!d||z
��S)
Nr�__len__�len�fileno�ba%Requests has determined the content-length for this request using the binary size of the file: however, the file has been opened in text mode (i.e. without the 'b' flag in the mode). This may lead to an incorrect content-length. In Requests 3.0, support will be removed for files in text mode.�tell�seek�)rErJrK�os�fstat�st_size�mode�warnings�warnr�io�UnsupportedOperationrMrNr4�IOError�max)�o�total_length�current_positionrKs    r?�	super_lenr]rs����L����q�)�����1�v�v���	��E�	�	���u���	��H�	�	��	��X�X�Z�Z�F��8�F�+�+�3�L��!�&� � ��
�.�$�������&�	�	�	��D�	����$�q�&���%�	%� �v�v�x�x���q�&�!�!�
%�l�&:�	%��F�F�1�a�L�L�L�#$�6�6�8�8�L��F�F�+�0�q�1�1�1�1����)�%�%�%�#$�L�L�L�%������%��!�	0�	0�	0�
�'�#/� ���
	0����*�����q�,�!1�1�2�2�2s7�B�B1�0B1�E�,AD.�.E�E�E �E Fc���tj�d��}|�|f}nd�tD��}	ddlm}m}d}|D]X}	tj�|��}n#t$rYdSwxYwtj�	|��r|}n�Y|�dSt|��}	d}
t|t��r|
�
d��}
|	j�|
��d}	||���|��}|r|drdnd}
||
|d	fSdS#|t"f$r|r�YdSwxYw#t$t&f$rYdSwxYw)
z;Returns the Requests tuple auth for a given url from netrc.�NETRCNc3�@K�|]}d�|��V��dS)z~/{}N)�format)�.0�fs  r?�	<genexpr>z!get_netrc_auth.<locals>.<genexpr>�s.����A�A��6�=�=��+�+�A�A�A�A�A�ArBr)�netrc�NetrcParseError�:�asciirrO)rP�environ�get�NETRC_FILESrerf�path�
expanduser�KeyError�existsr�
isinstancer�decode�netlocr5�authenticatorsrXr/�AttributeError)�url�raise_errors�
netrc_file�netrc_locationsrerf�
netrc_pathrc�loc�ri�splitstrr:r �login_is              r?�get_netrc_authr~�s��������(�(�J���%�-���A�A�[�A�A�A��-
�0�0�0�0�0�0�0�0��
� �	�	�A�
��g�(�(��+�+�����
�
�
�����	
�����w�~�~�c�"�"�
� �
���
�
���F�
�c�]�]�����c�3���	0����w�/�/�H��y���x�(�(��+��
	��U�:�&�&�5�5�d�;�;�F��
4� &�q�	�0�1�1�q���w�����3�3�
4�
4�� ��)�	�	�	��
��
�
�
�	�����
��(�
�
�
����
���sZ�E�A'�&E�'
A6�1E�5A6�6)E�!AE�=;D;�;E�
E�
E�E�E&�%E&c���t|dd��}|rLt|t��r9|ddkr/|ddkr%tj�|��SdSdSdSdS)z0Tries to guess the filename of the given object.�nameNr�<����>)�getattrrprrPrl�basename)�objr�s  r?�guess_filenamer��sx���3���%�%�D��&��D�*�-�-�&�$�q�'�S�.�.���H��O�O��w����%�%�%�&�&�&�&�.�.��OrBc�z�tj�|��r|Stj�|��\}}|rytj�|��sZtj�|��\}}d�||g��}|rtj�|���Ztj|��s|Stj|��}||���vr|Stj
��}tj�||�d��d��}tj�|��sOt|��5}|�|�
|����ddd��n#1swxYwY|S)z�Replace nonexistent paths that look like they refer to a member of a zip
    archive with the location of an extracted copy of the target, or else
    just return the provided path unchanged.
    �/r�N)rPrlror5�join�zipfile�
is_zipfile�ZipFile�namelist�tempfile�
gettempdir�atomic_open�write�read)rl�archive�member�prefix�zip_file�tmp�extracted_path�file_handlers        r?�extract_zipped_pathsr��s���

�w�~�~�d�������g�m�m�D�)�)�O�G�V�
�,�"�'�.�.��1�1�,��'�-�-��0�0�������6�6�*�+�+���,�"�'�.�.��1�1�,���g�&�&������w�'�'�H�
�X�&�&�(�(�(�(����
�
�
�C��W�\�\�#�v�|�|�C�'8�'8��'<�=�=�N�
�7�>�>�.�)�)�6�
��
(�
(�	6�L����x�}�}�V�4�4�5�5�5�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6�	6����	6�	6�	6�	6��s�;)F0�0F4�7F4c#�K�tjddkrtjntj}tjtj�|�����\}}	tj	|d��5}|V�ddd��n#1swxYwY|||��dS#t$rtj|���wxYw)z-Write a file to the disk in an atomic fashionrrO)�dir�wbN)�sys�version_inforP�renamer6r��mkstemprl�dirname�fdopen�
BaseException�remove)�filename�replacer�tmp_descriptor�tmp_name�tmp_handlers     r?r�r�s���� �,�Q�/�1�4�4�r�y�y�"�*�H�'�/�B�G�O�O�H�4M�4M�N�N�N��N�H��
�Y�~�t�
,�
,�	������	�	�	�	�	�	�	�	�	�	�	����	�	�	�	����8�$�$�$�$�$������
�	�(����
����s0�'B&�<B
�B&�
B�B&�B�B&�& Cc��|�dSt|ttttf��rtd���t
|��S)aTake an object and test to see if it can be represented as a
    dictionary. Unless it can not be represented as such, return an
    OrderedDict, e.g.,

    ::

        >>> from_key_val_list([('key', 'val')])
        OrderedDict([('key', 'val')])
        >>> from_key_val_list('string')
        Traceback (most recent call last):
        ...
        ValueError: cannot encode objects that are not 2-tuples
        >>> from_key_val_list({'key': 'val'})
        OrderedDict([('key', 'val')])

    :rtype: OrderedDict
    N�+cannot encode objects that are not 2-tuples)rprr
�boolr2�
ValueErrorr��values r?�from_key_val_listr�sG��$
�}��t��%�#�u�d�C�0�1�1�H��F�G�G�G��u���rBc���|�dSt|ttttf��rtd���t|t��r|���}t|��S)a�Take an object and test to see if it can be represented as a
    dictionary. If it can be, return a list of tuples, e.g.,

    ::

        >>> to_key_val_list([('key', 'val')])
        [('key', 'val')]
        >>> to_key_val_list({'key': 'val'})
        [('key', 'val')]
        >>> to_key_val_list('string')
        Traceback (most recent call last):
        ...
        ValueError: cannot encode objects that are not 2-tuples

    :rtype: list
    Nr�)	rprr
r�r2r�rrD�listr�s r?�to_key_val_listr�:sd��"
�}��t��%�#�u�d�C�0�1�1�H��F�G�G�G��%��!�!�����
�
����;�;�rBc���g}t|��D]N}|dd�|dd�cxkrdkrnnt|dd���}|�|���O|S)aParse lists as described by RFC 2068 Section 2.

    In particular, parse comma-separated lists where the elements of
    the list may include quoted-strings.  A quoted-string could
    contain a comma.  A non-quoted string could have quotes in the
    middle.  Quotes are removed automatically after parsing.

    It basically works like :func:`parse_set_header` just that items
    may appear multiple times and case sensitivity is preserved.

    The return value is a standard :class:`list`:

    >>> parse_list_header('token, "quoted value"')
    ['token', 'quoted value']

    To create a header from the :class:`list` again, use the
    :func:`dump_header` function.

    :param value: a string with a list header.
    :return: :class:`list`
    :rtype: list
    Nrr��")�_parse_list_header�unquote_header_value�append)r��result�items   r?�parse_list_headerr�Xs���.�F�"�5�)�)��������8�t�B�C�C�y�'�'�'�'�C�'�'�'�'�'�'��Q�r�T�
�3�3�D��
�
�d������MrBc���i}t|��D]a}d|vrd||<�|�dd��\}}|dd�|dd�cxkrdkrnnt|dd���}|||<�b|S)a^Parse lists of key, value pairs as described by RFC 2068 Section 2 and
    convert them into a python dict:

    >>> d = parse_dict_header('foo="is a fish", bar="as well"')
    >>> type(d) is dict
    True
    >>> sorted(d.items())
    [('bar', 'as well'), ('foo', 'is a fish')]

    If there is no value for a key it will be `None`:

    >>> parse_dict_header('key_without_value')
    {'key_without_value': None}

    To create a header from the :class:`dict` again, use the
    :func:`dump_header` function.

    :param value: a string with a dict header.
    :return: :class:`dict`
    :rtype: dict
    �=Nrr�r�)r�r5r�)r�r�r�r�s    r?�parse_dict_headerr�xs���,�F�"�5�)�)�����d�?�?��F�4�L���j�j��a�(�(���e���!��9��b�c�c�
�)�)�)�)�c�)�)�)�)�)�(��q��t��5�5�E���t����MrBc���|r`|d|dcxkrdkrGnnD|dd�}|r|dd�dkr*|�dd���d	d��S|S)
z�Unquotes a header value.  (Reversal of :func:`quote_header_value`).
    This does not use the real unquoting but what browsers are actually
    using for quoting.

    :param value: the header value to unquote.
    :rtype: str
    rr�r�rNrOz\\�\z\")r6)r��is_filenames  r?r�r��s���
�
C��q��U�2�Y�-�-�-�-�#�-�-�-�-�-�
�a��d����	C�e�B�Q�B�i�6�1�1��=�=���.�.�6�6�u�c�B�B�B��LrBc�2�i}|D]}|j||j<�|S)z�Returns a key/value dictionary from a CookieJar.

    :param cj: CookieJar object to extract cookies from.
    :rtype: dict
    )r�r�)�cj�cookie_dict�cookies   r?�dict_from_cookiejarr��s/���K��0�0��#)�<��F�K� � ��rBc�"�t||��S)z�Returns a CookieJar from a key/value dictionary.

    :param cj: CookieJar to insert cookies into.
    :param cookie_dict: Dict of key/values to insert into CookieJar.
    :rtype: CookieJar
    r)r�r�s  r?�add_dict_to_cookiejarr��s���{�B�/�/�/rBc�`�tjdt��tjdtj���}tjdtj���}tjd��}|�|��|�|��z|�|��zS)zlReturns encodings from given content string.

    :param content: bytestring to extract encodings from.
    z�In requests 3.0, get_encodings_from_content will be removed. For more information, please see the discussion on issue #2266. (This warning should only appear once.)z!<meta.*?charset=["\']*(.+?)["\'>])�flagsz+<meta.*?content=["\']*;?charset=(.+?)["\'>]z$^<\?xml.*?encoding=["\']*(.+?)["\'>])rTrU�DeprecationWarningr7�compiler9�findall)�content�
charset_re�	pragma_re�xml_res    r?�get_encodings_from_contentr��s���

�M�	-�	�	�����@���M�M�M�J��
�I�QS�QU�V�V�V�I�
�Z�?�
@�
@�F����w�'�'����g�&�&�
'��N�N�7�#�#�
$�%rBc��|�d��}|d���|dd�}}i}d}|D]�}|���}|rs|d}}|�d��}	|	dkr=|d|	��|��}||	dzd��|��}|||���<��||fS)	z�Returns content type and parameters from given header

    :param header: string
    :return: tuple containing content type and dictionary of
         parameters
    r)rrNz"' Tr�r�)r5�strip�find�lower)
�header�tokens�content_type�params�params_dict�items_to_strip�param�keyr��index_of_equalss
          r?�_parse_content_type_headerr��s����\�\�#�
�
�F�!�!�9�?�?�,�,�f�Q�R�R�j�&�L��K��N��-�-�����
�
���	-����C�#�j�j��o�o�O��"�$�$��,�_�,�-�3�3�N�C�C���o��1�2�2�3�9�9�.�I�I��',�K��	�	���$����$�$rBc��|�d��}|sdSt|��\}}d|vr|d�d��Sd|vrdSd|vrdSdS)	z}Returns encodings from given HTTP Header Dict.

    :param headers: dictionary to extract encoding from.
    :rtype: str
    zcontent-typeN�charsetz'"�textz
ISO-8859-1zapplication/json�utf-8)rjr�r�)�headersr�r�s   r?�get_encoding_from_headersr��s����;�;�~�.�.�L����t�5�l�C�C��L�&��F����i� �&�&�u�-�-�-�
�����|��\�)�)��w�*�)rBc#��K�|j�|D]}|V��dStj|j��d���}|D]}|�|��}|r|V��|�dd���}|r|V�dSdS)zStream decodes a iterator.Nr6��errorsrBT)�final)�encoding�codecs�getincrementaldecoderrq)�iterator�rr��decoder�chunk�rvs      r?�stream_decode_response_unicoder�s�����	�z���	�	�D��J�J�J�J���6�f�*�1�:�6�6�i�H�H�H�G�����
�^�^�E�
"�
"��
�	��H�H�H��	����4��	(�	(�B�	���������rBc#�K�d}|�|dkrt|��}|t|��kr)||||z�V�||z
}|t|��k�'dSdS)z Iterate over slices of a string.rN)rJ)�string�slice_length�poss   r?�iter_slicesr�&s{����
�C���|�q�0�0��6�{�{��

��F���
�
��S��|�+�+�,�,�,�,��|�����F���
�
�
�
�
�
rBc�:�tjdt��g}t|j��}|r;	t|j|��S#t$r|�|��YnwxYw	t|j|d���S#t$r
|jcYSwxYw)z�Returns the requested content back in unicode.

    :param r: Response object to get unicode content from.

    Tried:

    1. charset from content-type
    2. fall back and replace all unicode characters

    :rtype: str
    z�In requests 3.0, get_unicode_from_response will be removed. For more information, please see the discussion on issue #2266. (This warning should only appear once.)r6r�)
rTrUr�r�r�rr��UnicodeErrorr��	TypeError)r��tried_encodingsr�s   r?�get_unicode_from_responser�0s���
�M�	-�	�	����O�)���3�3�H��-�	-��q�y�(�+�+�+���	-�	-�	-��"�"�8�,�,�,�,�,�	-������1�9�h�y�9�9�9�9�������y�������s#�A	�	A+�*A+�/B�B�BzBABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~c��|�d��}tdt|����D]�}||dd�}t|��dkr�|���rn	t	t|d����}n #t$rtd|z���wxYw|tvr|||dd�z||<��d||z||<��d||z||<��d�	|��S)	z�Un-escape any percent-escape sequences in a URI that are unreserved
    characters. This leaves all reserved, illegal and non-ASCII bytes encoded.

    :rtype: str
    �%rrrO�z%Invalid percent-escape sequence: '%s'N�)
r5�rangerJ�isalnum�chrr2r�r�UNRESERVED_SETr�)�uri�parts�i�h�cs     r?�unquote_unreservedr
Ys��
�I�I�c�N�N�E�
�1�c�%�j�j�
!�
!�
&�
&���!�H�Q�q�S�M���q�6�6�Q�;�;�1�9�9�;�;�;�
N���A�r�
�
�O�O�����
N�
N�
N� �!H�1�!L�M�M�M�
N�����N�"�"��u�Q�x����|�+��a�����q��>��a����U�1�X�~�E�!�H�H�
�7�7�5�>�>�s�-B�B(c��d}d}	tt|��|���S#t$rt||���cYSwxYw)z�Re-quote the given URI.

    This function passes the given URI through an unquote/quote cycle to
    ensure that it is fully and consistently quoted.

    :rtype: str
    z!#$%&'()*+,/:;=?@[]~z!#$&'()*+,/:;=?@[]~)�safe)rr
r)r�safe_with_percent�safe_without_percents   r?�requote_urirqsk��/��0��	5��'��,�,�3D�E�E�E�E���5�5�5��S�3�4�4�4�4�4�4�	5���s�$�A�Ac
��tjdtj|����d}|�d��\}}tjdtjtt
|��������d}tjdtj|����d|z}||z||zkS)z�This function allows you to check if an IP belongs to a network subnet

    Example: returns True if ip = 192.168.1.1 and net = 192.168.1.0/24
             returns False if ip = 192.168.1.1 and net = 192.168.100.0/24

    :rtype: bool
    z=Lrr�)�struct�unpack�socket�	inet_atonr5�dotted_netmaskr2)�ip�net�ipaddr�netaddr�bits�netmask�networks       r?�address_in_networkr �s����]�4��!1�"�!5�!5�
6�
6�q�
9�F��I�I�c�N�N�M�G�T��m�D�&�"2�>�#�d�)�)�3L�3L�"M�"M�N�N�q�Q�G��m�D�&�"2�7�";�";�<�<�Q�?�'�I�G��W��'�G�"3�4�4rBc�l�ddd|z
zdz
z}tjtjd|����S)z�Converts mask from /xx format to xxx.xxx.xxx.xxx

    Example: if mask is 24 function returns 255.255.255.0

    :rtype: str
    l��r� z>I)r�	inet_ntoar�pack)�maskrs  r?rr�s8����b�4�i��1�,�,�D���F�K��d�3�3�4�4�4rBc�^�	tj|��n#tj$rYdSwxYwdS)z
    :rtype: bool
    FT)rr�error)�	string_ips r?�is_ipv4_addressr)�sD������#�#�#�#���<�����u�u������4s��*�*c�X�|�d��dkr�	t|�d��d��}n#t$rYdSwxYw|dks|dkrdS	t	j|�d��d��n#tj$rYdSwxYwdSdS)zV
    Very simple check of the cidr format in no_proxy variable.

    :rtype: bool
    r�rFr"rT)�countr2r5r�rrr')�string_networkr%s  r?�
is_valid_cidrr-�s������C� � �A�%�%�	��~�+�+�C�0�0��3�4�4�D�D���	�	�	��5�5�	�����!�8�8�t�b�y�y��5�	���^�1�1�#�6�6�q�9�:�:�:�:���|�	�	�	��5�5�	�����u��4s#�(A�
A�A�$-B�B%�$B%c#�K�|du}|r.tj�|��}|tj|<	dV�|r"|�tj|=dS|tj|<dSdS#|r|�tj|=n|tj|<wxYw)z�Set the environment variable 'env_name' to 'value'

    Save previous value, yield, and then restore the previous value stored in
    the environment variable 'env_name'.

    If 'value' is None, do nothingN)rPrirj)�env_namer��
value_changed�	old_values    r?�set_environr2�s�������%�M��%��J�N�N�8�,�,�	�$��
�8��1�
�����	1�� ��J�x�(�(�(�'0��
�8�$�$�$�		1�	1��=�	1�� ��J�x�(�(�'0��
�8�$�0�0�0�0s�A"�"#Bc���d�}|}|�|d��}t|��}|j�dS|r�d�|�dd���d��D��}t	|j��r<|D]8}t|��rt
|j|��rdS�*|j|krdS�9nb|j}|jr|d	�|j��z
}|D]4}|j�	|��s|�	|��rdS�5td|��5	t|j��}n#ttjf$rd
}YnwxYwddd��n#1swxYwY|rdSd
S)zL
    Returns whether we should bypass proxies or not.

    :rtype: bool
    c��tj�|��p0tj�|�����S�N)rPrirj�upper)�ks r?�<lambda>z'should_bypass_proxies.<locals>.<lambda>�s/��"�*�.�.��+�+�H�r�z�~�~�a�g�g�i�i�/H�/H�rBN�no_proxyTc3�K�|]}|�|V��	dSr5�)rbr:s  r?rdz(should_bypass_proxies.<locals>.<genexpr>�s;����
�
��T�
��
�
�
�
�
�
rB� r�,z:{}F)r�hostnamer6r5r)r-r �portra�endswithr2rr�r�gaierror)	rur9�	get_proxy�no_proxy_arg�parsed�proxy_ip�host_with_portr:�bypasss	         r?�should_bypass_proxiesrH�s)��I�H�I��L����9�Z�(�(��
�c�]�]�F�
����t�� �
�
�%�-�-�c�2�6�6�<�<�S�A�A�
�
�
���6�?�+�+�	 �$�
 �
 �� ��*�*� �)�&�/�8�D�D�$�#�t�t�$��_��0�0� �4�4�1�	
 �$�_�N��{�
<��%�,�,�v�{�";�";�;�� �
 �
 ���?�+�+�D�1�1� �^�5L�5L�T�5R�5R� � �4�4� �

�Z��	.�	.���	�!�&�/�2�2�F�F���6�?�+�	�	�	��F�F�F�	����	���������������������t��5s6�"E#�$D9�8E#�9E�E#�E�E#�#E'�*E'c�D�t||���riSt��S)zA
    Return a dict of environment proxies.

    :rtype: dict
    )r9)rHr)rur9s  r?�get_environ_proxiesrJs(���S�8�4�4�4���	��|�|�rBc��|pi}t|��}|j�.|�|j|�d����S|jdz|jz|jd|jzdg}d}|D]}||vr
||}n�|S)z�Select a proxy for the url, if applicable.

    :param url: The url being for the request
    :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs
    N�allz://zall://)rr>rj�scheme)ru�proxies�urlparts�
proxy_keys�proxy�	proxy_keys      r?�select_proxyrS#s����m��G���}�}�H��� ��{�{�8�?�G�K�K��,>�,>�?�?�?�	��%��(�"3�3����8�$�$�
�	�J�
�E����	������I�&�E��E� ��LrB�python-requestsc��|�dt��S)zO
    Return a string representing the default user agent.

    :rtype: str
    r�r)r�s r?�default_user_agentrV=s���d�d�K�K�(�(rBc�L�tt��tddd���S)z9
    :rtype: requests.structures.CaseInsensitiveDict
    z*/*z
keep-alive)z
User-AgentzAccept-Encoding�Accept�
Connection)rrV�DEFAULT_ACCEPT_ENCODINGr;rBr?�default_headersr[Fs2���(�*�*�2��"�	 � ���rBc��g}d}|�|��}|s|Stjd|��D]�}	|�dd��\}}n#t$r|d}}YnwxYwd|�d��i}|�d��D]X}	|�d��\}}n#t$rYn0wxYw|�|��||�|��<�Y|�|����|S)	z�Return a list of parsed link headers proxies.

    i.e. Link: <http:/.../front.jpeg>; rel=front; type="image/jpeg",<http://.../back.jpeg>; rel=back;type="image/jpeg"

    :rtype: list
    z '"z, *<r)rrruz<> '"r�)r�r7r5r�r�)	r��links�
replace_chars�valrur��linkr�r�s	         r?�parse_header_linksraRsA��
�E��M��K�K�
�&�&�E������x���&�&����	"��)�)�C��+�+�K�C�����	"�	"�	"��r��C�C�C�	"�����s�y�y��*�*�+���\�\�#�&�&�	H�	H�E�
�"�[�[��-�-�
��U�U���
�
�
����
����.3�[�[��-G�-G�D����=�)�)�*�*�
���T������Ls#�A�A!� A!�B,�,
B:�9B:�rhrO�c���|dd�}|tjtjfvrdS|dd�tjkrdS|dd�tjtjfvrdS|�t��}|dkrd	S|dkr,|ddd�tkrd
S|ddd�tkrdS|dkr*|dd�tkrd
S|dd�tkrdSdS)z
    :rtype: str
    N�zutf-32rcz	utf-8-sigrOzutf-16rr�z	utf-16-berz	utf-16-lez	utf-32-bez	utf-32-le)
r��BOM_UTF32_LE�BOM_UTF32_BE�BOM_UTF8�BOM_UTF16_LE�BOM_UTF16_BEr+�_null�_null2�_null3)�data�sample�	nullcounts   r?�guess_json_utfrq}s���"�1�"�X�F�
�&�%�v�':�;�;�;��x�
�b�q�b�z�V�_�$�$��{�
�b�q�b�z�f�)�6�+>�?�?�?��x����U�#�#�I��A�~�~��w��A�~�~��#�#�A�#�;�&� � ��;��!�$�Q�$�<�6�!�!��;��A�~�~��"�1�"�:�����;��!�"�"�:�����;��4rBc�f�t||��\}}}}}}|s||}}t||||||f��S)z�Given a URL that may or may not have a scheme, prepend the given scheme.
    Does not replace a present scheme with the one provided as an argument.

    :rtype: str
    )rr)ru�
new_schemerMrrrlr��query�fragments        r?�prepend_scheme_if_neededrv�sN��5=�S�*�4M�4M�1�F�F�D�&�%��
�$��V����v�v�t�V�U�H�E�F�F�FrBc��t|��}	t|j��t|j��f}n#tt
f$rd}YnwxYw|S)z{Given a url with authentication components, extract them into a tuple of
    username,password.

    :rtype: (str,str)
    )rr)rr�username�passwordrtr�)rurD�auths   r?�get_auth_from_urlr{�sd���c�]�]�F�����(�(�'�&�/�*B�*B�C�����I�&�������������Ks�(:�A�As^\S[^\r\n]*$|^$z^\S[^\r\n]*$|^$c��|\}}t|t��rt}nt}	|�|��std|z���dS#t$r&td|�d|�dt|�������wxYw)z�Verifies that header value is a string which doesn't contain
    leading whitespace or return characters. This prevents unintended
    header injection.

    :param header: tuple, in the format (name, value).
    z7Invalid return character or leading space in header: %szValue for header {z: z$} must be of type str or bytes, not N)rpr
�_CLEAN_HEADER_REGEX_BYTE�_CLEAN_HEADER_REGEX_STRr8rr��type)r�r�r��pats    r?�check_header_validityr��s����K�D�%��%����&�&���%��J��y�y����	b�� Y�\`� `�a�a�a�	b�	b���J�J�J��m�/3�t�t�U�U�U�D��K�K�K�I�J�J�	J�J���s�'A�0Bc��t|��\}}}}}}|s||}}|�dd��d}t|||||df��S)zW
    Given a url remove the fragment and the authentication part.

    :rtype: str
    �@rr�r)r�rsplitr)rurMrrrlr�rtrus       r?�
urldefragauthr��sb��5=�S�M�M�1�F�F�D�&�%���$��V���
�]�]�3��
"�
"�2�
&�F��v�v�t�V�U�B�?�@�@�@rBc���t|jdd��}|�Qt|jt��r7	||j��dS#t
tf$rtd���wxYwtd���)zfMove file pointer back to its recorded starting position
    so it can be read again on redirect.
    rNNz;An error occurred when rewinding request body for redirect.z+Unable to rewind request body for redirect.)r��bodyrp�_body_positionrrXr4r)�prepared_request�	body_seeks  r?�rewind_bodyr��s����(�-�v�t�<�<�I����,<�,K�]�![�![��	>��I�&�5�6�6�6�6�6����!�	>�	>�	>�'�)=�>�>�
>�	>����$�$Q�R�R�Rs�A�!A')Fr5)rT)h�__doc__r��
contextlibrVrPr7rrr�r�rTr��collectionsr�urllib3.utilrrrr�_internal_utilsr	�compatr
r�rrr
rrrrrrrrrrr�cookiesr�
structuresr�
exceptionsrrrrrk�where�DEFAULT_CA_BUNDLE_PATH�
DEFAULT_PORTSr�r5rZ�platformr@rGr]r~r�r��contextmanagerr�r�r�r�r�r�r�r�r�r�r�r�r�r��	frozensetrr
rr rr)r-r2rHrJrSrVr[ra�encoderkrlrmrqrvr{r�r}r~r�r�r�r;rBr?�<module>r�so�����
�
�
�����	�	�	�	�	�	�	�	�	�	�	�	�
�
�
�
�
�
�
�
�
�
�
�
�������������#�#�#�#�#�#�%�%�%�%�%�%�$�$�$�$�$�$�������-�-�-�-�-�-�9�9�9�9�9�9�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�)�(�(�(�(�(�+�+�+�+�+�+�G�G�G�G�G�G�G�G�G�G�G�G�#��$�������c�*�*�
��)�)��B�H�W�l�l�4�8�8�8�9J�K�L�L����
�<�7���%�%�%�N	/�	/�	/�
�
�
�:3�:3�:3�z6
�6
�6
�6
�r&�&�&����B��
�
���
����6���<���@���F����2���0�0�0�%�%�%�(%�%�%�2���2���$���!�!�!�J��M�O�O�����05�5�5�,5�5�5�5�5�5�������0��1�1���1�*:�:�:�z	�	�	�	����4)�)�)�)�	�	�	�"�"�"�L	�
�
�g����	����	�������@G�G�G�"
�
�
�"&�2�:�&;�<�<��$�"�*�%7�8�8��J�J�J�*A�A�A�"S�S�S�S�SrB