ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib64/python3.11/site-packages/requests/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/requests/__pycache__/cookies.cpython-311.pyc

�

�܋f�H�� �dZddlZddlZddlZddlmZddlmZmZm	Z	m
Z
mZ	ddlZn#e
$rddlZYnwxYwGd�d��ZGd�d	��Zd
�Zd�Zdd�ZGd
�de��ZGd�de	je��Zd�Zd�Zd�Zdd�Zd�ZdS)z�
requests.cookies
~~~~~~~~~~~~~~~~

Compatibility code to be able to use `cookielib.CookieJar` with requests.

requests.utils imports from here, so be careful with imports.
�N�)�to_native_string)�Morsel�MutableMapping�	cookielib�urlparse�
urlunparsec��eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
dd
�Zd�Zd�Z
d
�Zed���Zed���Zed���Zd	S)�MockRequesta�Wraps a `requests.Request` to mimic a `urllib2.Request`.

    The code in `cookielib.CookieJar` expects this interface in order to correctly
    manage cookie policies, i.e., determine whether a cookie can be set, given the
    domains of the request and the cookie.

    The original request object is read-only. The client is responsible for collecting
    the new headers via `get_new_headers()` and interpreting them appropriately. You
    probably want `get_cookie_header`, defined below.
    c�h�||_i|_t|jj��j|_dS�N)�_r�_new_headersr�url�scheme�type)�self�requests  �G/opt/cloudlinux/venv/lib64/python3.11/site-packages/requests/cookies.py�__init__zMockRequest.__init__#s+���������T�W�[�)�)�0��	�	�	�c��|jSr
)r�rs r�get_typezMockRequest.get_type(s
���y�rc�>�t|jj��jSr
)rrr�netlocrs r�get_hostzMockRequest.get_host+s������$�$�+�+rc�*�|���Sr
�rrs r�get_origin_req_hostzMockRequest.get_origin_req_host.s���}�}���rc�(�|jj�d��s|jjSt	|jjdd���}t|jj��}t
|j||j|j	|j
|jg��S)N�Hostzutf-8)�encoding)r�headers�getrrrr	r�path�params�query�fragment)r�host�parseds   r�get_full_urlzMockRequest.get_full_url1s����w��"�"�6�*�*�	��7�;������� 7�'�J�J�J���$�'�+�&�&����
�����
�����

�	
�	
�		
rc��dS�NT�rs r�is_unverifiablezMockRequest.is_unverifiableEs���trc�0�||jjvp||jvSr
)rr$r�r�names  r�
has_headerzMockRequest.has_headerHs���t�w��&�C�$�$�2C�*C�CrNc�t�|jj�||j�||����Sr
)rr$r%r)rr3�defaults   r�
get_headerzMockRequest.get_headerKs/���w��"�"�4��):�)>�)>�t�W�)M�)M�N�N�Nrc� �td���)zMcookielib has no legitimate use for this method; add it back if you find one.z=Cookie headers should be added with add_unredirected_header())�NotImplementedError)r�key�vals   r�
add_headerzMockRequest.add_headerNs��!�K�
�
�	
rc��||j|<dSr
�r�rr3�values   r�add_unredirected_headerz#MockRequest.add_unredirected_headerTs��"'���$���rc��|jSr
r>rs r�get_new_headerszMockRequest.get_new_headersWs��� � rc�*�|���Sr
)r0rs r�unverifiablezMockRequest.unverifiableZs���#�#�%�%�%rc�*�|���Sr
)r rs r�origin_req_hostzMockRequest.origin_req_host^s���'�'�)�)�)rc�*�|���Sr
rrs rr*zMockRequest.hostbs���}�}���rr
)�__name__�
__module__�__qualname__�__doc__rrrr r,r0r4r7r<rArC�propertyrErGr*r/rrrrs ������	�	�1�1�1�
���,�,�,����
�
�
�(���D�D�D�O�O�O�O�
�
�
�(�(�(�!�!�!��&�&��X�&��*�*��X�*�����X���rrc�$�eZdZdZd�Zd�Zd�ZdS)�MockResponsez�Wraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`.

    ...what? Basically, expose the parsed HTTP headers from the server response
    the way `cookielib` expects to see them.
    c��||_dS)z�Make a MockResponse for `cookielib` to read.

        :param headers: a httplib.HTTPMessage or analogous carrying the headers
        N��_headers)rr$s  rrzMockResponse.__init__ns��
 ��
�
�
rc��|jSr
rQrs r�infozMockResponse.infous
���}�rc�:�|j�|��dSr
)rR�
getheadersr2s  rrVzMockResponse.getheadersxs���
� � ��&�&�&�&�&rN)rIrJrKrLrrTrVr/rrrOrOgsK�������� � � ����'�'�'�'�'rrOc��t|d��r|jsdSt|��}t|jj��}|�||��dS)z�Extract the cookies from the response into a CookieJar.

    :param jar: cookielib.CookieJar (not necessarily a RequestsCookieJar)
    :param request: our own requests.Request object
    :param response: urllib3.HTTPResponse object
    �_original_responseN)�hasattrrXrrO�msg�extract_cookies)�jarr�response�req�ress     r�extract_cookies_to_jarr`|sb��
�H�2�3�3���8S����
�g�
�
�C�
�x�2�6�
7�
7�C�����S�!�!�!�!�!rc��t|��}|�|��|����d��S)zj
    Produce an appropriate Cookie header string to be sent with `request`, or None.

    :rtype: str
    �Cookie)r�add_cookie_headerrCr%)r\r�rs   r�get_cookie_headerre�sE��	�G���A����!���������"�"�8�,�,�,rc���g}|D]Q}|j|kr�|�||jkr�|�||jkr�*|�|j|j|jf���R|D]\}}}|�|||���dS)zkUnsets a cookie by name, by default over all domains and paths.

    Wraps CookieJar.clear(), is O(n).
    N)r3�domainr&�append�clear)�	cookiejarr3rgr&�
clearables�cookies      r�remove_cookie_by_namerm�s���
�J��E�E���;�$������&�F�M�"9�"9������� 3� 3�����6�=�&�+�v�{�C�D�D�D�D�(�,�,����d������d�+�+�+�+�,�,rc��eZdZdZdS)�CookieConflictErrorz�There are two cookies that meet the criteria specified in the cookie jar.
    Use .get and .set and include domain and path args in order to be more specific.
    N)rIrJrKrLr/rrroro�s���������rroc���eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zdd�Z�fd�Zd�Zd�Zd�Z�fd�Z�fd�Zdd�Zdd�Zd�Zd�Zd�Zd�Z�xZS)�RequestsCookieJara�Compatibility class; is a cookielib.CookieJar, but exposes a dict
    interface.

    This is the CookieJar we create by default for requests and sessions that
    don't specify one, since some clients may expect response.cookies and
    session.cookies to support dict operations.

    Requests does not use the dict interface internally; it's just for
    compatibility with external client code. All requests code should work
    out of the box with externally provided instances of ``CookieJar``, e.g.
    ``LWPCookieJar`` and ``FileCookieJar``.

    Unlike a regular CookieJar, this class is pickleable.

    .. warning:: dictionary operations that are normally O(1) may be O(n).
    Nc�V�	|�|||��S#t$r|cYSwxYw)z�Dict-like get() that also supports optional domain and path args in
        order to resolve naming collisions from using one cookie jar over
        multiple domains.

        .. warning:: operation is O(n), not O(1).
        )�_find_no_duplicates�KeyError)rr3r6rgr&s     rr%zRequestsCookieJar.get�sC��	��+�+�D�&�$�?�?�?���	�	�	��N�N�N�	���s��(�(c��|�;t|||�d��|�d�����dSt|t��rt	|��}nt||fi|��}|�|��|S)z�Dict-like set() that also supports optional domain and path args in
        order to resolve naming collisions from using one cookie jar over
        multiple domains.
        Nrgr&)rgr&)rmr%�
isinstancer�morsel_to_cookie�
create_cookie�
set_cookie)rr3r@�kwargs�cs     r�setzRequestsCookieJar.set�s����=�!��d�6�:�:�h�#7�#7�f�j�j��>P�>P�
�
�
�
�
�F��e�V�$�$�	5� ��'�'�A�A��d�E�4�4�V�4�4�A���������rc#�@K�t|��D]}|jV��dS)z�Dict-like iterkeys() that returns an iterator of names of cookies
        from the jar.

        .. seealso:: itervalues() and iteritems().
        N)�iterr3�rrls  r�iterkeyszRequestsCookieJar.iterkeys�s8�����4�j�j�	�	�F��+�����	�	rc�D�t|�����S)z�Dict-like keys() that returns a list of names of cookies from the
        jar.

        .. seealso:: values() and items().
        )�listr�rs r�keyszRequestsCookieJar.keys�s���D�M�M�O�O�$�$�$rc#�@K�t|��D]}|jV��dS)z�Dict-like itervalues() that returns an iterator of values of cookies
        from the jar.

        .. seealso:: iterkeys() and iteritems().
        N)r~r@rs  r�
itervalueszRequestsCookieJar.itervalues�s8�����4�j�j�	�	�F��,�����	�	rc�D�t|�����S)z�Dict-like values() that returns a list of values of cookies from the
        jar.

        .. seealso:: keys() and items().
        )r�r�rs r�valueszRequestsCookieJar.values�s���D�O�O�%�%�&�&�&rc#�NK�t|��D]}|j|jfV��dS)z�Dict-like iteritems() that returns an iterator of name-value tuples
        from the jar.

        .. seealso:: iterkeys() and itervalues().
        N)r~r3r@rs  r�	iteritemszRequestsCookieJar.iteritemss?�����4�j�j�	,�	,�F��+�v�|�+�+�+�+�+�	,�	,rc�D�t|�����S)z�Dict-like items() that returns a list of name-value tuples from the
        jar. Allows client-code to call ``dict(RequestsCookieJar)`` and get a
        vanilla python dict of key value pairs.

        .. seealso:: keys() and values().
        )r�r�rs r�itemszRequestsCookieJar.itemss���D�N�N�$�$�%�%�%rc�t�g}t|��D]%}|j|vr|�|j���&|S)z2Utility method to list all the domains in the jar.�r~rgrh�r�domainsrls   r�list_domainszRequestsCookieJar.list_domainssC�����4�j�j�	.�	.�F��}�G�+�+����v�}�-�-�-���rc�t�g}t|��D]%}|j|vr|�|j���&|S)z0Utility method to list all the paths in the jar.)r~r&rh)r�pathsrls   r�
list_pathszRequestsCookieJar.list_pathssC�����4�j�j�	*�	*�F��{�%�'�'����V�[�)�)�)���rc��g}t|��D]/}|j�|j|vrdS|�|j���0dS)zvReturns True if there are multiple domains in the jar.
        Returns False otherwise.

        :rtype: bool
        NTFr�r�s   r�multiple_domainsz"RequestsCookieJar.multiple_domains%sU�����4�j�j�	*�	*�F��}�(�V�]�g�-E�-E��t�t��N�N�6�=�)�)�)�)��urc��i}t|��D]+}|�|j|kr|�|j|kr|j||j<�,|S)z�Takes as an argument an optional domain and path and returns a plain
        old Python dict of name-value pairs of cookies that meet the
        requirements.

        :rtype: dict
        )r~rgr&r@r3)rrgr&�
dictionaryrls     r�get_dictzRequestsCookieJar.get_dict2sU���
��4�j�j�	7�	7�F���&�-�6�"9�"9�����t� 3� 3�*0�,�
�6�;�'���rc�j��	t���|��S#t$rYdSwxYwr.)�super�__contains__ro)rr3�	__class__s  �rr�zRequestsCookieJar.__contains__AsB���	��7�7�'�'��-�-�-��"�	�	�	��4�4�	���s� $�
2�2c�,�|�|��S)z�Dict-like __getitem__() for compatibility with client code. Throws
        exception if there are more than one cookie with name. In that case,
        use the more explicit get() method instead.

        .. warning:: operation is O(n), not O(1).
        )rsr2s  r�__getitem__zRequestsCookieJar.__getitem__Gs���'�'��-�-�-rc�2�|�||��dS)z�Dict-like __setitem__ for compatibility with client code. Throws
        exception if there is already a cookie of that name in the jar. In that
        case, use the more explicit set() method instead.
        N)r|r?s   r�__setitem__zRequestsCookieJar.__setitem__Ps��
	
����u�����rc�&�t||��dS)zlDeletes a cookie given a name. Wraps ``cookielib.CookieJar``'s
        ``remove_cookie_by_name()``.
        N)rmr2s  r�__delitem__zRequestsCookieJar.__delitem__Ws��	�d�D�)�)�)�)�)rc���t|jd��rT|j�d��r:|j�d��r |j�dd��|_t��j|g|�Ri|��S)N�
startswith�"z\"�)rYr@r��endswith�replacer�ry)rrl�argsrzr�s    �rryzRequestsCookieJar.set_cookie]s�����F�L�,�/�/�	;���'�'��,�,�	;���%�%�c�*�*�	;�
"�<�/�/��r�:�:�F�L�!�u�w�w�!�&�:�4�:�:�:�6�:�:�:rc����t|tj��r.|D])}|�t	j|�����*dSt���|��dS)zAUpdates this jar with cookies from another CookieJar or dict-likeN)rvr�	CookieJarry�copyr��update)r�otherrlr�s   �rr�zRequestsCookieJar.updatefsn����e�Y�0�1�1�	"��
3�
3������	�&� 1� 1�2�2�2�2�
3�
3�
�G�G�N�N�5�!�!�!�!�!rc��t|��D]0}|j|kr#|�|j|kr|�|j|kr	|jcS�1td|�d|�d|�����)a�Requests uses this method internally to get cookie values.

        If there are conflicting cookies, _find arbitrarily chooses one.
        See _find_no_duplicates if you want an exception thrown if there are
        conflicting cookies.

        :param name: a string containing name of cookie
        :param domain: (optional) string containing domain of cookie
        :param path: (optional) string containing path of cookie
        :return: cookie.value
        N�name=�	, domain=�, path=)r~r3rgr&r@rt)rr3rgr&rls     r�_findzRequestsCookieJar._findns~���4�j�j�	,�	,�F��{�d�"�"��>�V�]�f�%<�%<��|�v�{�d�':�':�%�|�+�+�+���I�t�I�I��I�I��I�I�J�J�Jrc���d}t|��D]B}|j|kr5|�|j|kr(|�|j|kr|�t	d|�����|j}�C|r|St
d|�d|�d|�����)a�Both ``__get_item__`` and ``get`` call this function: it's never
        used elsewhere in Requests.

        :param name: a string containing name of cookie
        :param domain: (optional) string containing domain of cookie
        :param path: (optional) string containing path of cookie
        :raises KeyError: if cookie is not found
        :raises CookieConflictError: if there are multiple cookies
            that match name and optionally domain and path
        :return: cookie.value
        Nz&There are multiple cookies with name, r�r�r�)r~r3rgr&ror@rt)rr3rgr&�toReturnrls      rrsz%RequestsCookieJar._find_no_duplicates�s������4�j�j�
	0�
	0�F��{�d�"�"��>�V�]�f�%<�%<��|�v�{�d�':�':�#�/�"5� Q�� Q� Q�#�#��$*�<����	��O��I�t�I�I��I�I��I�I�J�J�Jrc�b�|j���}|�d��|S)�4Unlike a normal CookieJar, this class is pickleable.�
_cookies_lock)�__dict__r��pop�r�states  r�__getstate__zRequestsCookieJar.__getstate__�s,���
�"�"�$�$��
�	�	�/�"�"�"��rc��|j�|��d|jvrtj��|_dSdS)r�r�N)r�r��	threading�RLockr�r�s  r�__setstate__zRequestsCookieJar.__setstate__�sC���
���U�#�#�#��$�-�/�/�!*��!2�!2�D����0�/rc��t��}|�|�����|�|��|S)z(Return a copy of this RequestsCookieJar.)rq�
set_policy�
get_policyr�)r�new_cjs  rr�zRequestsCookieJar.copy�sB��"�$�$�����$�/�/�+�+�,�,�,��
�
�d�����
rc��|jS)z&Return the CookiePolicy instance used.)�_policyrs rr�zRequestsCookieJar.get_policy�s
���|�r)NNN�NN)rIrJrKrLr%r|r�r�r�r�r�r�r�r�r�r�r�r�r�r�ryr�r�rsr�r�r�r��
__classcell__)r�s@rrqrq�s����������"
�
�
�
����&���%�%�%����'�'�'�,�,�,�&�&�&����������
�
�
�
������.�.�.����*�*�*�;�;�;�;�;�"�"�"�"�"�K�K�K�K�(K�K�K�K�:���3�3�3����������rrqc��|�dSt|d��r|���Stj|��}|���|D])}|�tj|�����*|S)Nr�)rYr�riry)r\�new_jarrls   r�_copy_cookie_jarr��s{��
�{��t��s�F�����x�x�z�z���i��n�n�G��M�M�O�O�O��.�.�����4�9�V�,�,�-�-�-�-��Nrc��d||ddddddddddidd�
}t|��t|��z
}|rtd	t|�������|�|��t	|d
��|d<t	|d��|d
<|d�d��|d<t	|d��|d<t
jdi|��S)z�Make a cookie from underspecified parameters.

    By default, the pair of `name` and `value` will be set for the domain ''
    and sent on every request (this is sometimes called a "supercookie").
    rNr��/FT�HttpOnly)
�versionr3r@�portrgr&�secure�expires�discard�comment�comment_url�rest�rfc2109z2create_cookie() got unexpected keyword arguments: r��port_specifiedrg�domain_specified�.�domain_initial_dotr&�path_specifiedr/)r|�	TypeErrorr�r��boolr�rrb)r3r@rz�result�badargss     rrxrx�s��������������T�"����F� �&�k�k�C��K�K�'�G��
��P��g���P�P�
�
�	
��M�M�&����#�F�6�N�3�3�F���!%�f�X�&6�!7�!7�F���#)�(�#3�#>�#>�s�#C�#C�F�� �#�F�6�N�3�3�F�����%�%�f�%�%�%rc��d}|dr_	ttj��t|d��z��}n^#t$rtd|d�d����wxYw|dr/d}t	jtj|d|����}t|dt|d��d|d	||j	|d
dd|didt|d
��|j
|dpd��
�
S)zBConvert a Morsel object into a Cookie containing the one k/v pair.Nzmax-agez	max-age: z must be integerr�z%a, %d-%b-%Y %H:%M:%S GMTr�Frgr&r��httponlyr�r�r)
r�r�r�rgr�r3r&r�r�r�r�r@r�)�int�time�
ValueErrorr��calendar�timegm�strptimerxr�r:r@)�morselr��
time_templates   rrwrw�s3���G�
�i��S�	M��$�)�+�+��F�9�,=�(>�(>�>�?�?�G�G���	M�	M�	M��K��y�(9�K�K�K�L�L�L�	M����	�	�	�S�3�
��/�$�-��y�0A�=�"Q�"Q�R�R����y�!���	�*�+�+���h���
�Z�
�F�^�
��&��,�
-���F�8�$�%�%��l��y�!�&�Q����s�6A�$A'Tc��|�t��}|�@d�|D��}|D]1}|s||vr)|�t|||�����2|S)aCReturns a CookieJar from a key/value dictionary.

    :param cookie_dict: Dict of key/values to insert into CookieJar.
    :param cookiejar: (optional) A cookiejar to add the cookies to.
    :param overwrite: (optional) If False, will not replace cookies
        already in the jar with new ones.
    :rtype: CookieJar
    Nc��g|]	}|j��
Sr/)r3)�.0rls  r�
<listcomp>z'cookiejar_from_dict.<locals>.<listcomp>s��>�>�>�&�&�+�>�>�>r)rqryrx)�cookie_dictrj�	overwrite�names_from_jarr3s     r�cookiejar_from_dictr�	s|����%�'�'�	���>�>�I�>�>�>���	M�	M�D��
M�T��7�7��$�$�]�4��T�9J�%K�%K�L�L�L���rc�^�t|tj��std���t|t��rt||d���}n[t|tj��rA	|�|��n*#t$r|D]}|�|���YnwxYw|S)z�Add cookies to cookiejar and returns a merged CookieJar.

    :param cookiejar: CookieJar object to add the cookies to.
    :param cookies: Dictionary or CookieJar object to be added.
    :rtype: CookieJar
    z!You can only merge into CookieJarF)rjr�)	rvrr�r��dictr�r��AttributeErrorry)rj�cookies�
cookie_in_jars   r�
merge_cookiesr�s����i��!4�5�5�>��<�=�=�=��'�4� � �4�'��9�PU�V�V�V�	�	�	�G�Y�0�	1�	1�4�	4����W�%�%�%�%���	4�	4�	4�!(�
4�
4�
��$�$�]�3�3�3�3�
4�
4�	4�����s�-B�$B*�)B*r�r.)rLr�r�r��_internal_utilsr�compatrrrrr	r��ImportError�dummy_threadingrrOr`rerm�RuntimeErrorror�rqr�rxrwr�r�r/rr�<module>r�s�����������������-�-�-�-�-�-�K�K�K�K�K�K�K�K�K�K�K�K�K�K�(��������(�(�(�'�'�'�'�'�'�(����M�M�M�M�M�M�M�M�`'�'�'�'�'�'�'�'�*
"�
"�
"� -�-�-�,�,�,�,�&�����,����E�E�E�E�E�	�+�^�E�E�E�P���"&�"&�"&�J���:����*����s�)�	5�5

Zerion Mini Shell 1.0