ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib/python3.11/site-packages/urllib3/util/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/urllib3/util/__pycache__/request.cpython-311.pyc

�

�܋f����UddlmZddlZddlZddlmZddlmZddlm	Z	ddl
mZejrdd	l
mZd
Zegd���ZdZ		ddlZn#e$rddlZYnwxYwed
z
Zn#e$rYnwxYw	ddlZedz
Zn#e$rYnwxYwGd�de��ZejZded<ejeefZhd�Z 						d2d3d�Z!d4d$�Z"d5d)�Z#Gd*�d+ej$��Z%d6d1�Z&dS)7�)�annotationsN)�	b64encode)�Enum�)�UnrewindableBodyError�)�to_bytes)�Finalz@@@SKIP_HEADER@@@)�accept-encoding�host�
user-agentzgzip,deflatez,brz,zstdc��eZdZdZdS)�_TYPE_FAILEDTELLrN)�__name__�
__module__�__qualname__�token���K/opt/cloudlinux/venv/lib64/python3.11/site-packages/urllib3/util/request.pyrr's������
�E�E�ErrzFinal[_TYPE_FAILEDTELL]�_FAILEDTELL>�GET�HEAD�TRACE�DELETE�CONNECT�OPTIONS�
keep_alive�bool | None�accept_encoding�bool | list[str] | str | None�
user_agent�
str | None�
basic_auth�proxy_basic_auth�
disable_cache�return�dict[str, str]c���i}|rMt|t��rn2t|t��rd�|��}nt}||d<|r||d<|rd|d<|r:dt|�d���������|d<|r:dt|�d���������|d	<|rd
|d<|S)a�
    Shortcuts for generating request headers.

    :param keep_alive:
        If ``True``, adds 'connection: keep-alive' header.

    :param accept_encoding:
        Can be a boolean, list, or string.
        ``True`` translates to 'gzip,deflate'.  If either the ``brotli`` or
        ``brotlicffi`` package is installed 'gzip,deflate,br' is used instead.
        List will get joined by comma.
        String will be used as provided.

    :param user_agent:
        String representing the user-agent you want, such as
        "python-urllib3/0.6"

    :param basic_auth:
        Colon-separated username:password string for 'authorization: basic ...'
        auth header.

    :param proxy_basic_auth:
        Colon-separated username:password string for 'proxy-authorization: basic ...'
        auth header.

    :param disable_cache:
        If ``True``, adds 'cache-control: no-cache' header.

    Example:

    .. code-block:: python

        import urllib3

        print(urllib3.util.make_headers(keep_alive=True, user_agent="Batman/1.0"))
        # {'connection': 'keep-alive', 'user-agent': 'Batman/1.0'}
        print(urllib3.util.make_headers(accept_encoding=True))
        # {'accept-encoding': 'gzip,deflate'}
    �,rr
z
keep-alive�
connectionzBasic zlatin-1�
authorizationzproxy-authorizationzno-cachez
cache-control)�
isinstance�str�list�join�ACCEPT_ENCODINGr�encode�decode)rr r"r$r%r&�headerss       r�make_headersr57s(��^!�G��5��o�s�+�+�	.��
���
.�
.�	.�!�h�h��7�7�O�O�-�O�%4��!�"��+� *�����-� ,�����H�
H�Y�z�0�0��;�;�<�<�C�C�E�E�G�G�	��	
��N�
N�Y�/�6�6�y�A�A�B�B�I�I�K�K�M�M�	�!�	
��.�#-��� ��Nr�body�
typing.Any�pos�_TYPE_BODY_POSITION | Nonec��|�t||��n>t|dd���-	|���}n#t$r
t}YnwxYw|S)z
    If a position is provided, move file to that point.
    Otherwise, we'll attempt to record a position for future use.
    N�tell)�rewind_body�getattrr;�OSErrorr)r6r8s  r�set_file_positionr?�so�����D�#�����	��v�t�	$�	$�	0�	��)�)�+�+�C�C���	�	�	��C�C�C�	����
�Js�;�A�A�typing.IO[typing.AnyStr]�body_pos�_TYPE_BODY_POSITION�Nonec�"�t|dd��}|�Et|t��r0	||��dS#t$r}t	d��|�d}~wwxYw|t
urt	d���t
dt|���d����)z�
    Attempt to rewind body to a certain position.
    Primarily used for request redirects and retries.

    :param body:
        File-like object that supports seek.

    :param int pos:
        Position to seek to in file.
    �seekNzAAn error occurred when rewinding request body for redirect/retry.zRUnable to record file position for rewinding request body during a redirect/retry.z1body_pos must be of type integer, instead it was �.)r=r-�intr>rr�
ValueError�type)r6rA�	body_seek�es    rr<r<�s�����f�d�+�+�I����H�c�!:�!:��	��I�h��������	�	�	�'�S����
�����	����
�[�	 �	 �#�
4�
�
�	
�
�Q��X���Q�Q�Q�
�
�	
s�7�
A�A�Ac�$�eZdZUded<ded<dS)�ChunksAndContentLengthztyping.Iterable[bytes] | None�chunksz
int | None�content_lengthN)rrr�__annotations__rrrrMrM�s*�������)�)�)�)������rrM�typing.Any | None�methodr.�	blocksizerGc������#d}|���tvrd}n�d}n�t�ttf��r&t���f}t
|d��}n�t�d��rd	��fd�}|��}d}n_	t���}�f}|j	}nD#t$r7	t���}d}n!#t$rtd�����d�wxYwYnwxYwt||���S)
aRTakes the HTTP request method, body, and blocksize and
    transforms them into an iterable of chunks to pass to
    socket.sendall() and an optional 'Content-Length' header.

    A 'Content-Length' of 'None' indicates the length of the body
    can't be determined so should use 'Transfer-Encoding: chunked'
    for framing instead.
    Nr�readr'�typing.Iterable[bytes]c3��K�t�tj��}	�����}|sdS|r|�d��}|V��5)NTz
iso-8859-1)r-�io�
TextIOBaserUr2)r2�	datablockrSr6s  ��r�chunk_readablez&body_to_chunks.<locals>.chunk_readable�sd�������b�m�4�4�F�
 � �I�I�i�0�0�	� ���E��?� )� 0� 0�� >� >�I�����

 rzO'body' must be a bytes-like object, file-like object, or iterable. Instead was )rNrO)r'rV)
�upper�_METHODS_NOT_EXPECTING_BODYr-r.�bytesr	�len�hasattr�
memoryview�nbytes�	TypeError�iterrM)r6rRrSrNrOr[�mvs` `    r�body_to_chunksrf�sq����$�|����<�<�>�>�!<�<�<��N�N�!�N�N�
�D�3��,�	'�	'�''��4�.�.�"���V�A�Y�����
��v�	�	�"'�		 �		 �		 �		 �		 �		 �		 � ��!�!�����	'��D�!�!�B��W�F��Y�N�N���		�		�		�
��d����!%�����
�
�
��A�8<�A�A�����
������			����"���O�O�O�Os*�B)�)
C*�4C�C*�C$�$C*�)C*)NNNNNN)rrr r!r"r#r$r#r%r#r&rr'r()r6r7r8r9r'r9)r6r@rArBr'rC)r6rQrRr.rSrGr'rM)'�
__future__rrX�typing�base64r�enumr�
exceptionsr�utilr	�
TYPE_CHECKING�typing_extensionsr
�SKIP_HEADER�	frozenset�SKIPPABLE_HEADERSr1�
brotlicffi�_unused_module_brotli�ImportError�brotli�	zstandard�_unused_module_zstdrrrrP�UnionrGrBr]r5r?r<�
NamedTuplerMrfrrr�<module>rzs��"�"�"�"�"�"�"�	�	�	�	�
�
�
�
�������������.�.�.�.�.�.�������	��(�'�'�'�'�'�'�"���I�G�G�G�H�H�� ���/�2�2�2�2�2���/�/�/�.�.�.�.�.�.�/����
�u��O�O���	�	�	��D�	�����+�+�+�+��w��O�O���	�	�	��D�	���������t����(8�'=��=�=�=�=��l�3�(8�#8�9��W�V�V��#�59�!�!�#'�!%�
L�L�L�L�L�^����(
�
�
�
�<�����V�.����
CP�CP�CP�CP�CP�CPsB�A
�A"�
	A�A"�A�A"�"A*�)A*�.A8�8B�?B

Zerion Mini Shell 1.0