OwlCyberSecurity - MANAGER
Edit File: utils.cpython-311.pyc
� ������h�������������������������f����d�Z�ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddlZddlm Z �ddlmZmZ�ddlmZ�ddlmZ�ddlmZmZmZmZ�dd lmZmZmZmZmZmZ�dd lm Z!�ddlm"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(�ddl)m*Z*�dd l+m,Z,m-Z-m.Z.m/Z/�ddl0m1Z1�dZ2�ej3����������������������Z4ddd�Z5d�6���������������������ej7��������d�ed�������������d���������������������������������Z8ej9��������dk����rd��Z:d��Z"d��Z;d��Z<dJd�Z=d��Z>d ��Z?ej@��������d!����������������ZAd"��ZBd#��ZCd$��ZDd%��ZEdJd&�ZFd'��ZGd(��ZHd)��ZId*��ZJd+��ZKd,��ZLd-��ZMd.��ZN�eOd/������������ZPd0��ZQd1��ZRd2��ZSd3��ZTd4��ZUd5��ZVej@��������d6����������������ZWd7��ZXdKd8�ZYd9��ZZdLd:�Z[dMd<�Z\d=��Z]d>��Z^d?�_��������������������d@������������Z`e`dAz��Zae`dBz��ZbdC��ZcdD��ZddE��ZedF��ZfdG��ZgdH��ZhdI��ZidS�)Nz� requests.utils ~~~~~~~~~~~~~~ This module provides utility functions that are used within Requests that are also useful for external consumption. �����N)�OrderedDict)�make_headers� parse_url����)�certs��__version__)�_HEADER_VALIDATORS_BYTE�_HEADER_VALIDATORS_STR�HEADER_VALIDATORS�to_native_string)�Mapping� basestring�bytes� getproxies�getproxies_environment� integer_types)�parse_http_list)�proxy_bypass�proxy_bypass_environment�quote�str�unquote�urlparse� urlunparse��cookiejar_from_dict)�FileModeWarning� InvalidHeader� InvalidURL�UnrewindableBodyError)�CaseInsensitiveDict)z.netrc�_netrc�P���i���)�http�httpsz, z,\s*T)�accept_encodingzaccept-encoding�win32c������������������L���� �dd�l�}n#�t����������$�r�Y�dS�w�xY�w �|���������������������|j��������d������������}t ����������|���������������������|d������������d���������������������}|���������������������|d������������d���������}n#�t����������t����������f$�r�Y�dS�w�xY�w|r|sdS�|���������������������d������������}|D�]t}|dk����rd|�vr�d S�|� ��������������������dd ������������}|� ��������������������dd������������}|� ��������������������d d������������}t����������j��������||�t����������j��������������������r�d S��udS�)Nr���Fz;Software\Microsoft\Windows\CurrentVersion\Internet Settings�ProxyEnable� ProxyOverride�;z<local>�.Tz\.�*z.*�?) �winreg�ImportError�OpenKey�HKEY_CURRENT_USER�int�QueryValueEx�OSError� ValueError�split�replace�re�match�I)�hostr0����internetSettings�proxyEnable� proxyOverride�tests��� �E/opt/cloudlinux/venv/lib64/python3.11/site-packages/requests/utils.py�proxy_bypass_registryrC���L���sv����� ��M�M�M�M���� �� �� ��5�5� ���� �%�~�~��(�N� �� �� ��f�1�1�2B�M�R�R�ST�U�V�V�K�"�/�/�0@�/�R�R�ST�U�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 A:��:B�Bc������������������Z�����t������������������������rt����������|�������������S�t����������|�������������S�)z�Return True, if the host should be bypassed. Checks proxy settings gathered from the environment, if specified, or the registry. )r���r���rC���)r=���s��� rB���r���r���p���s.�������"�#�#�� /�+�D�1�1�1�(��.�.�.�����c������������������N�����t����������|�d������������r|������������������������������������}�|�S�)z/Returns an internal sequence dictionary update.�items)�hasattrrG���)�ds��� rB����dict_to_sequencerJ���|���s(��������q�'����� �G�G�I�I���HrE���c�����������������������d�}d}t����������|�d������������rt����������|�������������}n�t����������|�d������������r|�j��������}n~t����������|�d������������rn �|������������������������������������}t����������j��������|������������j��������}d|�j��������vrt����������j��������dt�����������������������n#�t����������j��������t����������f$�r�Y�nw�xY�wt����������|�d������������r� �|�� ����������������������������������}t����������|�d������������rW|�U �|����������������������dd �������������|�� ����������������������������������}|����������������������|pd�������������n'#�t����������$�r�d}Y�nw�xY�wn#�t����������$�r�|�|}Y�nw�xY�w|�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����)rH���rM���rN����os�fstat�st_size�mode�warnings�warnr����io�UnsupportedOperation�AttributeErrorrP���rQ���r6����max)�o�total_length�current_positionrN���s��� rB���� super_lenr`�������s�������L����q�)������1�v�v��� ��E� � ����u��� ��H� � ��� ��X�X�Z�Z�F���8�F�+�+�3�L���!�&� � �� �2��$� �� �� �����'��8�� �� �� �� �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��B8�7B8�E��3AD5��5E�E�E�EFc�����������������������t�����������j�����������������������������d������������}|�|f}nd��t����������D���������������} �ddlm}m}�d}|D�]X} �t�����������j�����������������������������|������������}n#�t����������$�r�Y��dS�w�xY�wt�����������j��������� ��������������������|������������r|}�n�Y|�dS�t����������|�������������} d} t����������|�t����������������������r| � ��������������������d������������} | j�����������������������������| ������������d���������} ��||���������������������������������|������������}|r|d���������rdnd} || ���������|d ���������fS�dS�#�|t"����������f$�r�|r��Y�dS�w�xY�w#�t$����������t&����������f$�r�Y�dS�w�xY�w) z;Returns the Requests tuple auth for a given url from netrc.�NETRCNc��������������3���� ���K����|�] }d�|���V���� dS�)z~/N��)�.0�fs��� rB���� <genexpr>z!get_netrc_auth.<locals>.<genexpr>����s(����������9�9��8��8�8�9�9�9�9�9�9rE���r���)�NetrcParseError�netrc����:�asciir���rR���)rS����environ�get�NETRC_FILESri���rh����path� expanduser�KeyError�existsr���� isinstancer����decode�netlocr8����authenticatorsr6���r1���r[���)�url�raise_errors� netrc_file�netrc_locationsrh���ri���� netrc_pathrf����loc�ri�splitstrr=���r#����login_is��� rB����get_netrc_authr��������s������������(�(�J���%�-���9�9�[�9�9�9��- �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�%�a�y�/�!�!�a���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|d���������dk����r/|d���������dk����r%t����������j�����������������������������|������������S�dS�dS�dS�dS�)z0Tries to guess the filename of the given object.�nameNr����<����>)�getattrrs���r���rS���ro����basename)�objr����s��� rB����guess_filenamer�������sw�������3���%�%�D���&� �4��,�,��&��a��C���D��H�PS�O�O��w����%�%�%�&��&��&��&���O�OrE���c����������������������t�����������j�����������������������������|�������������r|�S�t�����������j�����������������������������|�������������\��}}|r|t�����������j�����������������������������|������������s]t�����������j�����������������������������|������������\��}}|sn8d���������������������||g������������}|rt�����������j�����������������������������|�������������]t����������j��������|������������s|�S�t����������j��������|������������}||�����������������������������������vr|�S�t����������j ����������������������}t�����������j�����������������������������||���������������������d������������d���������������������}t�����������j�����������������������������|������������sOt����������|������������5�}|���������������������|� ��������������������|�������������������������ddd�������������n#�1�swxY�w�Y���|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)rS���ro���rr���r8����join�zipfile� is_zipfile�ZipFile�namelist�tempfile� gettempdir�atomic_open�write�read)ro����archive�member�prefix�zip_file�tmp�extracted_path�file_handlers��� rB����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����>)F3�3F7�:F7c��������������#����H��K����t����������j��������t����������j�����������������������������|��������������������������\��}} �t����������j��������|d������������5�}|V���ddd�������������n#�1�swxY�w�Y���t����������j��������||��������������dS�#�t����������$�r�t����������j��������|���������������w�xY�w)z-Write a file to the disk in an atomic fashion)�dir�wbN) r�����mkstemprS���ro����dirname�fdopenr9���� BaseException�remove)�filename�tmp_descriptor�tmp_name�tmp_handlers��� rB���r����r����,��s������������ (�/�B�G�O�O�H�4M�4M�N�N�N��N�H�� �Y�~�t� ,� ,�� ������ �� �� �� �� �� �� �� �� �� �� ����� �� �� �� � � �8�X�&�&�&�&�&��������� � �(���� ����s/����B��A�B��A#�#B��&A#�'B�� B!c�����������������������|��dS�t����������|�t����������t����������t����������t����������f������������rt����������d�������������t ����������|�������������S�)a��Take 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)rs���r���r����boolr4���r7���r�����values��� rB����from_key_val_listr����9��sG������$� �}��t��%�#�u�d�C�0�1�1��H��F�G�G�G��u���rE���c������������������������|��dS�t����������|�t����������t����������t����������t����������f������������rt����������d�������������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����) rs���r���r���r����r4���r7���r���rG����listr����s��� rB����to_key_val_listr����T��sd������"� �}��t��%�#�u�d�C�0�1�1��H��F�G�G�G��%��!�!������ � ����;�;�rE���c������������������������g�}t����������|�������������D�]N}|dd����������|dd����������cxk����rdk����rn�nt����������|dd����������������������}|���������������������|��������������O|S�)a��Parse 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 Nr���r�����")�_parse_list_header�unquote_header_value�append)r�����result�items��� rB����parse_list_headerr����r��s�������.��F�"�5�)�)����������8�t�B�C�C�y�'�'�'�'�C�'�'�'�'�'�'��Q�r�T� �3�3�D�� � �d������MrE���c������������������������i�}t����������|�������������D�]a}d|vrd||<����|���������������������dd������������\��}}�|�dd����������|�dd����������cxk����rdk����rn�nt����������|�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 �=Nr���r����r����)r����r8���r����)r����r����r����r����s��� rB����parse_dict_headerr�������s�������,��F�"�5�)�)�������d�?�?��F�4�L���j�j��a�(�(���e���!��9��b�c�c� �)�)�)�)�c�)�)�)�)�)�(��q��t��5�5�E���t����MrE���c������������������������|�r`|�d���������|�d���������cxk����rdk����rGn�nD|�dd����������}�|r|�dd����������dk����r*|�����������������������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 r���r����r����r���NrR���z\\�\z\")r9���)r�����is_filenames��� rB���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��LrE���c������������������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��� rB����dict_from_cookiejarr�������s/��������K���0��0��#)�<��F�K� � ��rE���c������������������"�����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��� rB����add_dict_to_cookiejarr�������s��������{�B�/�/�/rE���c������������������`����t����������j��������dt�����������������������t����������j��������dt����������j���������������������}t����������j��������dt����������j���������������������}t����������j��������d������������}|���������������������|�������������|���������������������|�������������z���|���������������������|�������������z���S�)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=["\']*(.+?)["\'>])rW���rX����DeprecationWarningr:����compiler<����findall)�content� charset_re� pragma_re�xml_res��� rB����get_encodings_from_contentr�������s������� � �M� 1�� � ��������@���M�M�M�J�� �I�QS�QU�V�V�V�I� �Z�?� @� @�F�� ���7�#�#� � � �G� $� $� %� �.�.�� !� !� "�rE���c����������������������|�����������������������d������������}|d��������������������������������������������|dd����������}}i�}d}|D�]�}|�����������������������������������}|rs|d}}|���������������������d������������} | dk����r=|d| �������������������������������|������������}|| dz���d�������������������������������|������������}|||�����������������������������������<�����||fS�) z�Returns content type and parameters from given header :param header: string :return: tuple containing content type and dictionary of parameters r,���r���r���Nz"' Tr����r����)r8����strip�find�lower) �header�tokens�content_type�params�params_dict�items_to_strip�param�keyr�����index_of_equalss ��� rB����_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�3�3�4�:�:�>�J�J��',�K�� � ���$����$�$rE���c�����������������������|�����������������������d������������}|sdS�t����������|������������\��}}d|v�r|d������������������������������d������������S�d|v�rdS�d|v�rdS�dS�) z}Returns encodings from given HTTP Header Dict. :param headers: dictionary to extract encoding from. :rtype: str zcontent-typeN�charsetz'"�textz ISO-8859-1zapplication/json�utf-8)rm���r����r����)�headersr����r����s��� rB����get_encoding_from_headersr������s���������;�;�~�.�.�L�����t�5�l�C�C��L�&��F����i� �&�&�u�-�-�-� �����|��\�)�)��w��*�)rE���c��������������#��������K����|j���������� |�E�d{V����dS��t����������j��������|j���������������������d�������������}|�D�]}|���������������������|������������}|r|V����|���������������������dd�������������}|r|V���dS�dS�)zStream decodes an iterator.Nr9�����errorsrE���T)�final)�encoding�codecs�getincrementaldecoderrt���)�iterator�r�decoder�chunk�rvs��� rB����stream_decode_response_unicoder����3��s������������ �z������������6�f�*�1�:�6�6�i�H�H�H�G������� �^�^�E� "� "�� �� ��H�H�H�� ����4�� (� (�B� �����������rE���c��������������#�������K����d}|�|dk����rt����������|�������������}|t����������|�������������k�����r)|�|||z�������������V���||z ��}|t����������|�������������k������'dS�dS�)z Iterate over slices of a string.r���N)rM���)�string�slice_length�poss��� rB����iter_slicesr����D��s{���������� �C���|�q�0�0��6�{�{�� ��F��� � ��S�3��-�-�.�.�.�.��|������F��� � � � � � rE���c������������������:����t����������j��������dt�����������������������g�}t����������|�j��������������������}|r; �t����������|�j��������|������������S�#�t����������$�r�|���������������������|�������������Y�nw�xY�w �t����������|�j��������|d�������������S�#�t����������$�r �|�j��������cY�S�w�xY�w)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.)r9���r����) rW���rX���r����r����r����r���r�����UnicodeErrorr����� TypeError)r�����tried_encodingsr����s��� rB����get_unicode_from_responser����N��s�������� �M� 1�� � �������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������������}t����������dt����������|������������������������D�]�}||���������dd����������}t����������|������������dk����r�|�����������������������������������ro �t ����������t����������|d������������������������}n!#�t����������$�r�t����������d|��d��������������w�xY�w|t����������v�r|||���������dd����������z���||<�����d||������������||<�����d||������������||<�����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 �%r���r���rR�������z"Invalid percent-escape sequence: '�'N��) r8����rangerM����isalnum�chrr4���r7���r ����UNRESERVED_SETr����)�uri�parts�i�h�cs��� rB����unquote_unreservedr��{��s������ �I�I�c�N�N�E� �1�c�%�j�j� !� !�� &�� &���!�H�Q�q�S�M���q�6�6�Q�;�;�1�9�9�;�;�;� L���A�r� � �O�O������ L�� L�� L� �!J�a�!J�!J�!J�K�K�K� L������N�"�"��u�Q�x����|�+��a���)�u�Q�x�>�>��a���%�5��8�~�~�E�!�H�H� �7�7�5�>�>�s����-B�B)c�����������������������d}d} �t����������t����������|�������������|�������������S�#�t����������$�r�t����������|�|�������������cY�S�w�xY�w)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)r���r��r ���)r���safe_with_percent�safe_without_percents��� rB����requote_urir�����sk�������/��0�� 5���'��,�,�3D�E�E�E�E����5��5��5���S�3�4�4�4�4�4�4� 5���s����$��A�Ac����������� �����������t����������j��������dt����������j��������|�������������������������d���������}|���������������������d������������\��}}t����������j��������dt����������j��������t����������t ����������|������������������������������������������������d���������}t����������j��������dt����������j��������|������������������������d���������|z��}||z��||z��k����S�)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=Lr���r����)�struct�unpack�socket� inet_atonr8����dotted_netmaskr4���)�ip�net�ipaddr�netaddr�bits�netmask�networks��� rB����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�4rE���c������������������l�����ddd|�z ��z��dz ��z��}t����������j��������t����������j��������d|������������������������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)�maskr��s��� rB���r��r�����s8���������b�4�i��1�,�,�D���F�K��d�3�3�4�4�4rE���c������������������T����� �t����������j��������|��������������n#�t����������$�r�Y�dS�w�xY�wdS�)z :rtype: bool FT)r��r��r6���)� string_ips��� rB����is_ipv4_addressr&�����sB����������#�#�#�#����������u�u������4s������ %�%c������������������N����|�����������������������d������������dk����r� �t����������|����������������������d������������d���������������������}n#�t����������$�r�Y�dS�w�xY�w|dk�����s|dk����rdS� �t ����������j��������|����������������������d������������d����������������������n#�t����������$�r�Y�dS�w�xY�wdS�dS�)zV Very simple check of the cidr format in no_proxy variable. :rtype: bool r����r���Fr ��r���T)�countr4���r8���r7���r��r��r6���)�string_networkr#��s��� rB���� 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.t�����������j�����������������������������|�������������}|t�����������j��������|�<��� �dV���|r"|�t�����������j��������|�=�dS�|t�����������j��������|�<���dS�dS�#�|r|�t�����������j��������|�=�n|t�����������j��������|�<���w�xY�w)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)rS���rl���rm���)�env_namer����� value_changed� old_values��� rB����set_environr/�����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��������|������������r�dS��*|j��������|k����r�dS��9nR|j��������}|j��������r |d |j�����������z ��}|D�]4}|j�����������������������������|������������s|���������������������|������������r�dS��5t����������d|������������5�� �t����������|j��������������������}n#�t����������t����������j ��������f$�r�d }Y�nw�xY�wddd�������������n#�1�swxY�w�Y���|rdS�d S�)zL Returns whether we should bypass proxies or not. :rtype: bool c�����������������������t�����������j�����������������������������|�������������p0t�����������j�����������������������������|������������������������������������������������S��N)rS���rl���rm����upper)r����s��� rB���� get_proxyz(should_bypass_proxies.<locals>.get_proxy��s1�������z�~�~�c�"�"�A�b�j�n�n�S�Y�Y�[�[�&A�&A�ArE���N�no_proxyTc��������������3�������K����|�]}|�|V���� d�S�r2��rd���)re���r=���s��� rB���rg���z(should_bypass_proxies.<locals>.<genexpr>��s'����������R�R�T�T�R�D�R�R�R�R�R�RrE���� r���,�:F)r����hostnamer9���r8���r&��r*��r���port�endswithr/��r���r����r���gaierror) rw���r5��r4���no_proxy_arg�parsed�proxy_ip�host_with_portr=����bypasss ��� rB����should_bypass_proxiesrC�����s#�����B��B��B� ��L����9�Z�(�(�� �c�]�]�F� ����t��� ��S�R�X�%5�%5�c�2�%>�%>�%D�%D�S�%I�%I�R�R�R���6�?�+�+�� �$�� �� �� ��*�*�� �)�&�/�8�D�D��$�#�t�t�$��_��0�0�� �4�4��1� ��$�_�N��{�� 4��"3�f�k�"3�"3�3�� �� �� ���?�+�+�D�1�1�� �^�5L�5L�T�5R�5R�� �� �4�4� � � �Z�� .� .����� �!�&�/�2�2�F�F���6�?�+�� �� �� ��F�F�F� ���� �������������������������������������t��5s6����E�D)�(E�)E�E�E�E�E�Ec������������������D�����t����������|�|�������������ri�S�t������������������������S�)zA Return a dict of environment proxies. :rtype: dict �r5��)rC��r���)rw���r5��s��� rB����get_environ_proxiesrF��8��s(��������S�8�4�4�4���� ��|�|�rE���c����������������������|pi�}t����������|�������������}|j���������.|���������������������|j��������|���������������������d������������������������S�|j��������dz���|j��������z���|j��������d|j��������z���dg}d}|D�]}||v�r ||���������}�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:��rm����scheme)rw����proxies�urlparts� proxy_keys�proxy� proxy_keys��� rB����select_proxyrO��D��s���������m��G���}�}�H��� ��{�{�8�?�G�K�K��,>�,>�?�?�?�� ��%��(�"3�3����8�$�$� � �J�� �E������ ������I�&�E��E�� ���LrE���c������������������d����|�|ni�}|�j���������}t����������|������������j��������}|���������������������d������������}|�����������������������������������}|rct����������||�������������sRt ����������||�������������}|���������������������||���������������������d������������������������}|r|���������������������||�������������|S�)a���This method takes proxy information from a request and configuration input to resolve a mapping of target proxies. This will consider settings such a NO_PROXY to strip proxy configurations. :param request: Request or PreparedRequest :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs :param trust_env: Boolean declaring whether to trust environment configs :rtype: dict Nr5��rE��rH��)rw���r���rI��rm����copyrC��rF��� setdefault) �requestrJ��� trust_envrw���rI��r5���new_proxies�environ_proxiesrM��s ��� rB����resolve_proxiesrW��^��s��������!�,�g�g�"�G� �+�C� �c�]�]� !�F��{�{�:�&�&�H��,�,�.�.�K���2�.�s�X�F�F�F��2�-�c�H�E�E�E���#�#�F�O�,?�,?��,F�,F�G�G���� 2��"�"�6�5�1�1�1��rE����python-requestsc�����������������������|���dt��������������S�)zO Return a string representing the default user agent. :rtype: str r����r���)r����s��� rB����default_user_agentrZ��y��s��������"�"�[�"�"�"rE���c�������������������L�����t����������t������������������������t����������ddd�������������S�)z9 :rtype: requests.structures.CaseInsensitiveDict z*/*z keep-alive)z User-AgentzAccept-Encoding�Accept� Connection)r"���rZ���DEFAULT_ACCEPT_ENCODINGrd���rE���rB����default_headersr_�����s2��������,�.�.�6��&� �� �����rE���c����������������������g�}d}|�����������������������|������������}�|�s|S�t����������j��������d|�������������D�]�} �|���������������������dd������������\��}}n#�t����������$�r�|d}}Y�nw�xY�wd|����������������������d������������i}|���������������������d������������D�]X} �|���������������������d������������\��}}�n#�t����������$�r�Y��n0w�xY�w|�����������������������|������������||����������������������|������������<����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,���r���r��rw���z<> '"r����)r����r:���r8���r7���r����) r�����links� replace_chars�valrw���r�����linkr����r����s ��� rB����parse_header_linksre�����sA������ �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:��rk���rR�������c�����������������������|�dd����������}|t�����������j��������t�����������j��������fv�rdS�|dd����������t�����������j��������k����rdS�|dd����������t�����������j��������t�����������j��������fv�rdS�|���������������������t����������������������}|dk����rd S�|dk����r,|ddd����������t����������k����rd S�|ddd����������t����������k����rdS�|dk����r*|dd����������t����������k����rd S�|dd����������t����������k����rdS�dS�)z :rtype: str N����zutf-32rg��z utf-8-sigrR���zutf-16r���r����z utf-16-ber���z 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��� rB����guess_json_utfru�����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�"�:�����;��!�"�"�:�����;��4rE���c�����������������������t����������|�������������}|\��}}}}}}} |j��������} | s|| }} |rd���������������������|| g������������} |�|}|�d}t����������|| |d|| 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 �@Nr��)r���ru���r����r���)rw���� new_schemer?��rI���authr=���r;��ro����query�fragmentru���s��� rB����prepend_scheme_if_neededr|�����s���������s�^�^�F�6<�3�F�D�$��d�E�8���]�F���$��V�����*�����4��.�)�)�� �~����|����v�v�t�R���A�B�B�BrE���c�����������������������t����������|�������������} �t����������|j��������������������t����������|j��������������������f}n#�t����������t ����������f$�r�d}Y�nw�xY�w|S�)z{Given a url with authentication components, extract them into a tuple of username,password. :rtype: (str,str) )r��r��)r���r����username�passwordr[���r����)rw���r?��ry��s��� rB����get_auth_from_urlr������sd��������c�]�]�F�����(�(�'�&�/�*B�*B�C�����I�&�����������������Ks����(:��A�Ac������������������T�����|�\��}}t����������|�|d�������������t����������|�|d�������������dS�)z�Verifies that header parts don't contain leading whitespace reserved characters, or return characters. :param header: tuple, in the format (name, value). r���r���N)�_validate_header_part)r����r����r����s��� rB����check_header_validityr�����s7��������K�D�%��&�$��*�*�*��&�%��+�+�+�+�+rE���c����������� �������D����t����������|t����������������������rt����������|���������}nHt����������|t����������������������rt����������|���������}n%t����������d|�d|���dt ����������|����������������������������|���������������������|������������s|dk����rdnd}t����������d|��d|���������������d�S�) Nz Header part (z) from z# must be of type str or bytes, not r���r����r����zSInvalid leading whitespace, reserved character(s), or returncharacter(s) in header z: )rs���r���r���r���r ���r����typer;���)r�����header_part�header_validator_index� validator�header_kinds��� rB���r���r�����s��������+�s�#�#�� �*�+A�B� � � �K�� '� '�� �+�,B�C� � �� E�K�� E�� E�&�� E�� E�15�k�1B�1B� E�� E� �� �� � ��?�?�;�'�'�� � 6�!� ;� ;�f�f���� E�&1� E�� E�5@� E�� E� �� �� � �� rE���c�����������������������t����������|�������������\��}}}}}}|s||}}|���������������������dd������������d���������}t����������|||||df������������S�)zW Given a url remove the fragment and the authentication part. :rtype: str rw��r���r����r��)r����rsplitr���)rw���rI��ru���ro���r����rz��r{��s��� rB���� urldefragauthr���&��sb�������5=�S�M�M�1�F�F�D�&�%�����$��V��� �]�]�3�� "� "�2� &�F��v�v�t�V�U�B�?�@�@�@rE���c������������������������t����������|�j��������dd������������}|�Jt����������|�j��������t����������������������r0 ��||�j���������������������dS�#�t ����������$�r�t ����������d�������������w�xY�wt ����������d�������������)zfMove file pointer back to its recorded starting position so it can be read again on redirect. rQ���Nz;An error occurred when rewinding request body for redirect.z+Unable to rewind request body for redirect.)r�����bodyrs����_body_positionr���r6���r!���)�prepared_request� body_seeks��� rB����rewind_bodyr���7��s���������(�-�v�t�<�<�I�����'��"��"�� ��I�&�5�6�6�6�6�6���� �� �� �'�M����� � ���� �$�$Q�R�R�Rs����A��A )Fr2��)T)rX��)j�__doc__r����� contextlibrY���rS���r:���r��r���sysr����rW���r�����collectionsr����urllib3.utilr���r���r��r���r ����_internal_utilsr ���r���r���r ����compatr���r���r���r���r���r���r���r����r���r���r���r���r���r���r����cookiesr���� exceptionsr���r���r ���r!���� structuresr"���rn����where�DEFAULT_CA_BUNDLE_PATH� DEFAULT_PORTSr����r8���r^���platformrC���rJ���r`���r����r����r�����contextmanagerr����r����r����r����r����r����r����r����r����r����r����r����r����r����� frozensetr��r��r��r��r��r&��r*��r/��rC��rF��rO��rW��rZ��r_��re���encodero��rp��rq��ru��r|��r���r���r���r���r���rd���rE���rB����<module>r������s���������� � � ���������� � � � �� � � � �� � � � �� � � � �� � � � �� � � � �����������������#��#��#��#��#��#��0��0��0��0��0��0��0��0��������������$��$��$��$��$��$��������������������������������������������������������:��9��9��9��9��9�������������������������������������)��(��(��(��(��(�������������������������,��+��+��+��+��+�"��$��������c�*�*� ���)�)��B�H�W�l�l�4�8�8�8�9J�K�L�L������ ��<�7���"��"��"�H /�� /�� /� �� �� �?3��?3��?3�D6 ��6 ��6 ��6 �r&��&��&�"��"��"�J��� �� ���� ������6�����<�����@�����F�������2�����0��0��0������2%��%��%�2�����2�����"�����$��$��$�P���M����� �����05��5��5�,5��5��5�5��5��5�����������0���1��1����1�*9��9��9�x �� �� �� ������4�������6#��#��#��#������"��"��"�L� � � �g���� ���� ���������@C��C��C�: �� �� � ,��,��,� �� �� �&A��A��A�"S��S��S��S��SrE���