Your IP : 3.15.26.235


Current Path : /opt/alt/python313/lib64/python3.13/http/__pycache__/
Upload File :
Current File : //opt/alt/python313/lib64/python3.13/http/__pycache__/cookies.cpython-313.pyc

�

*}g�M���SrSSKrSSKrSSKr/SQrSR
rSR
rSR
r"SS\	5r
\R\R-S	-r
\
S
-r\"\"S55\"\"\\55-
Vs0sH	nUSU-_M snr\R)\"S
5S\"S5S05 \R*"S\R,"\
5-5R.rSr\R*"S5R4rSrSr/SQr/SQrS\\4Sjr "SS\!5r"Sr#\#S-r$\R*"S\#-S-\$-S-\RJ\RL-5r'"S S!\!5r("S"S#\(5r)gs snf)$a.

Here's a sample session to show how to use this module.
At the moment, this is the only documentation.

The Basics
----------

Importing is easy...

   >>> from http import cookies

Most of the time you start by creating a cookie.

   >>> C = cookies.SimpleCookie()

Once you've created your Cookie, you can add values just as if it were
a dictionary.

   >>> C = cookies.SimpleCookie()
   >>> C["fig"] = "newton"
   >>> C["sugar"] = "wafer"
   >>> C.output()
   'Set-Cookie: fig=newton\r\nSet-Cookie: sugar=wafer'

Notice that the printable representation of a Cookie is the
appropriate format for a Set-Cookie: header.  This is the
default behavior.  You can change the header and printed
attributes by using the .output() function

   >>> C = cookies.SimpleCookie()
   >>> C["rocky"] = "road"
   >>> C["rocky"]["path"] = "/cookie"
   >>> print(C.output(header="Cookie:"))
   Cookie: rocky=road; Path=/cookie
   >>> print(C.output(attrs=[], header="Cookie:"))
   Cookie: rocky=road

The load() method of a Cookie extracts cookies from a string.  In a
CGI script, you would use this method to extract the cookies from the
HTTP_COOKIE environment variable.

   >>> C = cookies.SimpleCookie()
   >>> C.load("chips=ahoy; vienna=finger")
   >>> C.output()
   'Set-Cookie: chips=ahoy\r\nSet-Cookie: vienna=finger'

The load() method is darn-tootin smart about identifying cookies
within a string.  Escaped quotation marks, nested semicolons, and other
such trickeries do not confuse it.

   >>> C = cookies.SimpleCookie()
   >>> C.load('keebler="E=everybody; L=\\"Loves\\"; fudge=\\012;";')
   >>> print(C)
   Set-Cookie: keebler="E=everybody; L=\"Loves\"; fudge=\012;"

Each element of the Cookie also supports all of the RFC 2109
Cookie attributes.  Here's an example which sets the Path
attribute.

   >>> C = cookies.SimpleCookie()
   >>> C["oreo"] = "doublestuff"
   >>> C["oreo"]["path"] = "/"
   >>> print(C)
   Set-Cookie: oreo=doublestuff; Path=/

Each dictionary element has a 'value' attribute, which gives you
back the value associated with the key.

   >>> C = cookies.SimpleCookie()
   >>> C["twix"] = "none for you"
   >>> C["twix"].value
   'none for you'

The SimpleCookie expects that all values should be standard strings.
Just to be sure, SimpleCookie invokes the str() builtin to convert
the value to a string, when the values are set dictionary-style.

   >>> C = cookies.SimpleCookie()
   >>> C["number"] = 7
   >>> C["string"] = "seven"
   >>> C["number"].value
   '7'
   >>> C["string"].value
   'seven'
   >>> C.output()
   'Set-Cookie: number=7\r\nSet-Cookie: string=seven'

Finis.
�N)�CookieError�
BaseCookie�SimpleCookie�z; � c��\rSrSrSrg)r��N)�__name__�
__module__�__qualname__�__firstlineno__�__static_attributes__r
��3/opt/alt/python313/lib64/python3.13/http/cookies.pyrr�s��rrz!#$%&'*+-.^_`|~:z
 ()/<=>?@[]{}�z\%03o�"�\"�\z\\z[%s]+c�b�Ub[U5(aU$SUR[5-S-$)z�Quote a string for use in a cookie header.

If the string does not need to be double-quoted, then just return the
string.  Otherwise, surround the string in doublequotes and quote
(with a \) special characters.
r)�
_is_legal_key�	translate�_Translator��strs r�_quoter�s1���{�m�C�(�(��
��S�]�]�;�/�/�#�5�5rz\\(?:([0-3][0-7][0-7])|(.))c�P�US(a[[USS55$US$)N���)�chr�int)�ms r�_unquote_replacer$�s'����t��3�q��t�Q�<� � ���t�rc�|�Ub[U5S:aU$USS:wd	USS:waU$USSn[[U5$)Nr rr���r)�len�_unquote_subr$rs r�_unquoter)�sO���{�c�#�h��l��
�
�1�v��}��B��3���
��a��)�C��(�#�.�.r)�Mon�Tue�Wed�Thu�Fri�Sat�Sun)
N�Jan�Feb�Mar�Apr�May�Jun�Jul�Aug�Sep�Oct�Nov�Decc	�\�SSKJnJn U"5nU"XP-5u	pgp�p�p�nSXX�UXiX�4-$)Nr)�gmtime�timez#%s, %02d %3s %4d %02d:%02d:%02d GMT)r?r>)�future�weekdayname�	monthnamer>r?�now�year�month�day�hh�mm�ss�wd�y�zs               r�_getdaterM�sE��!�
�&�C�-3�C�L�-A�*�D��"�"��0��O�S�E�"2�D�b�E�F�Frc
��\rSrSrSrSSSSSSS	S
SS.	rS
S1rSr\S5r	\S5r
\S5rSrS"Sjr
Sr\R rSrSrSrSrSrSrS#Sjr\rSrS"SjrS"S jr\"\R<5rS!r g)$�Morsel��a/A class to hold ONE (key, value) pair.

In a cookie, each such pair may have several attributes, so this class is
used to keep the attributes associated with the appropriate key,value pair.
This class also includes a coded_value attribute, which is used to hold
the network representation of the value.
�expires�Path�Comment�DomainzMax-Age�Secure�HttpOnly�Version�SameSite)	rQ�path�comment�domain�max-age�secure�httponly�version�samesiter]r^c��S=Ul=UlUlURHn[RXS5 M g)Nr)�_key�_value�_coded_value�	_reserved�dict�__setitem__)�self�keys  r�__init__�Morsel.__init__s8��6:�:��	�:�D�K�$�"3��>�>�C����T��+�"rc��UR$�N)rb�rhs rri�
Morsel.keys���y�y�rc��UR$rm)rcrns r�value�Morsel.values���{�{�rc��UR$rm)rdrns r�coded_value�Morsel.coded_values��� � � rc��UR5nXR;a[SU<35e[R	XU5 g�NzInvalid attribute )�lowerrerrfrg)rh�K�Vs   rrg�Morsel.__setitem__#s5��
�G�G�I���N�N�"���;�<�<�����!�$rNc��UR5nXR;a[SU<35e[R	XU5$rw)rxrerrf�
setdefault)rhri�vals   rr}�Morsel.setdefault)s6���i�i�k���n�n�$���=�>�>����t�#�.�.rc�"�[U[5(d[$[R	X5=(aY UR
UR
:H=(a9 URUR:H=(a URUR:H$rm)�
isinstancerO�NotImplementedrf�__eq__rcrbrd�rh�morsels  rr��
Morsel.__eq__/sk���&�&�)�)�!�!����D�)�9����v�}�}�,�9��	�	�V�[�[�(�9��!�!�V�%8�%8�8�	:rc��[5n[RX5 URRUR5 U$rm)rOrf�update�__dict__r�s  r�copy�Morsel.copy9s0��������F�!������t�}�}�-��
rc���0n[U5R5H7up4UR5nX0R;a[	SU<35eXBU'M9 [RX5 grw)rf�itemsrxrerr�)rh�values�datarir~s     rr��
Morsel.update?sX�����V��*�*�,�H�C��)�)�+�C��.�.�(�!�C�"A�B�B���I�	-�
	
���D�rc�<�UR5UR;$rm)rxre)rhrys  r�
isReservedKey�Morsel.isReservedKeyHs���w�w�y�D�N�N�*�*rc��UR5UR;a[SU<35e[U5(d[SU<35eXlX lX0lg)NzAttempt to set a reserved key zIllegal key )rxrerrrbrcrd)rhrir~�	coded_vals    r�set�
Morsel.setKsM���9�9�;�$�.�.�(��C�I�J�J��S�!�!��#�7�8�8��	���%�rc�J�URURURS.$)N)rirqrt�rbrcrdrns r�__getstate__�Morsel.__getstate__Vs#���9�9��[�[��,�,�
�	
rc�@�USUlUSUlUSUlg)Nrirqrtr�)rh�states  r�__setstate__�Morsel.__setstate__]s%���%�L��	��G�n���!�-�0��rc�2�U<SURU5<3$)Nr)�OutputString)rh�attrs�headers   r�output�
Morsel.outputbs�� �$�"3�"3�E�":�;�;rc�\�SURR<SUR5<S3$)N�<�: �>)�	__class__rr�rns r�__repr__�Morsel.__repr__gs ��!�^�^�4�4�d�6G�6G�6I�J�Jrc�J�SURU5RSS5-$)Nz�
        <script type="text/javascript">
        <!-- begin hiding
        document.cookie = "%s";
        // end hiding -->
        </script>
        rr)r��replace)rhr�s  r�	js_output�Morsel.js_outputjs.���� � ��'�/�/��U�;�
=�	=rc�$�/nURnU"UR<SUR<35 UcURn[	UR55nUGH&upVUS:XaMXQ;aMUS:Xa<[
U[5(a'U"URU<S[U5<35 MWUS:Xa1[
U[5(aU"SURUU4-5 M�US:Xa<[
U[5(a'U"URU<S[U5<35 M�XPR;a+U(a!U"[URU55 GMGM
U"URU<SU<35 GM) [U5$)N�=rrQr\z%s=%drZ)
�appendrirtre�sortedr�r�r"rMrr�_flags�_semispacejoin)rhr��resultr�r�rirqs       rr��Morsel.OutputStringtsB��������	�$�(�(�D�$4�$4�5�6��=��N�N�E��t�z�z�|�$���J�C���{������i��J�u�c�$:�$:��$�.�.��"5�x���G�H��	�!�j���&<�&<��w�$�.�.��"5�u�!=�=�>��	�!�j���&<�&<��$�.�.��"5�v�e�}�E�F����#���3�t�~�~�c�2�3�4���$�.�.��"5�u�=�>� �$�f�%�%r)rdrbrcrm)N�Set-Cookie:)!rrr
r�__doc__rer�rj�propertyrirqrtrgr}r��object�__ne__r�r�r�r�r�r�r��__str__r�r�r��classmethod�types�GenericAlias�__class_getitem__rr
rrrOrO�s����*���������
�I��
�
#�F�,����������!��!�%�/�:��]�]�F�� �+�	&�
�1�
<��G�K�=�&�B$�E�$6�$6�7�rrOz,\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=z\[\]z�
    \s*                            # Optional whitespace at start of cookie
    (?P<key>                       # Start of group 'key'
    [a	]+?   # Any word of at least one letter
    )                              # End of group 'key'
    (                              # Optional group: there may not be a value.
    \s*=\s*                          # Equal Sign
    (?P<val>                         # Start of group 'val'
    "(?:[^\\"]|\\.)*"                  # Any doublequoted string
    |                                  # or
    \w{3},\s[\w\d\s-]{9,11}\s[\d:]{8}\sGMT  # Special case for "expires" attr
    |                                  # or
    [a-]*      # Any word or empty string
    )                                # End of group 'val'
    )?                             # End of optional value group
    \s*                            # Any number of spaces.
    (\s+|;|$)                      # Ending either at space, semicolon, or EOS.
    c�j�\rSrSrSrSrSrSSjrSrSr	SS	jr
\
rS
rSSjr
Sr\4S
jrSrg)ri�z'A container class for a set of Morsels.c��X4$)z�real_value, coded_value = value_decode(STRING)
Called prior to setting a cookie's value from the network
representation.  The VALUE is the value read from HTTP
header.
Override this function to modify the behavior of cookies.
r
�rhr~s  r�value_decode�BaseCookie.value_decode�s���x�rc��[U5nX"4$)z�real_value, coded_value = value_encode(VALUE)
Called prior to setting a cookie's value from the dictionary
representation.  The VALUE is the value being assigned.
Override this function to modify the behavior of cookies.
r�rhr~�strvals   r�value_encode�BaseCookie.value_encode�s���S����~�rNc�6�U(aURU5 ggrm)�load)rh�inputs  rrj�BaseCookie.__init__�s����I�I�e��rc��URU[55nURXU5 [R	XU5 g)z+Private method for setting a cookie's valueN)�getrOr�rfrg)rhri�
real_valuert�Ms     r�__set�BaseCookie.__set�s2���H�H�S�&�(�#��	���c�{�+�����A�&rc��[U[5(a[RXU5 gUR	U5up4URXU5 g)zDictionary style assignment.N)r�rOrfrgr��_BaseCookie__set)rhrirq�rval�cvals     rrg�BaseCookie.__setitem__�s?���e�V�$�$����T��.��*�*�5�1�J�D��J�J�s�$�'rc��/n[UR55nUH%upgURURX55 M' UR	U5$)z"Return a string suitable for HTTP.)r�r�r�r��join)rhr�r��sepr�r�rirqs        rr��BaseCookie.output�sG�����t�z�z�|�$���J�C��M�M�%�,�,�u�5�6� ��x�x���rc���/n[UR55nUH0up4URU<S[UR5<35 M2 SUR
R<S[U5<S3$)Nr�r�r�r�)r�r�r��reprrqr�r�
_spacejoin)rh�lr�rirqs     rr��BaseCookie.__repr__�sV�����t�z�z�|�$���J�C�
�H�H��T�%�+�+�%6�7�8� �!�^�^�4�4�j��m�D�Drc��/n[UR55nUH%upEURURU55 M' [	U5$)z(Return a string suitable for JavaScript.)r�r�r�r��	_nulljoin)rhr�r�r�rirqs      rr��BaseCookie.js_output�sC�����t�z�z�|�$���J�C��M�M�%�/�/�%�0�1� ��� � rc��[U[5(aURU5 gUR5H	up#X0U'M g)z�Load cookies from a string (presumably HTTP_COOKIE) or
from a dictionary.  Loading cookies from a dictionary 'd'
is equivalent to calling:
    map(Cookie.__setitem__, d.keys(), d.values())
N)r�r�_BaseCookie__parse_stringr�)rh�rawdatarirqs    rr��BaseCookie.load�sB���g�s�#�#�����(�
	�&�m�m�o�
��!�S�	�.�rc�2�Sn[U5n/nSnSnSnSUs=::aU:Ga5O GO1URX5n	U	(dGOU	RS5U	RS5p�U	RS5nU
SS:Xa U(dMpUR	XzSSU45 O�U
R5[R;a_U(dgUc7U
R5[R;aUR	XzS45 OGgUR	Xz[U545 O)Ub%UR	X�URU545 SnOgSUs=::a	U:aGM/O SnUH7up�nX�:XaUceX�U
'MX�:XdeUup�URX�U5 X
nM9 g)	NrFrr rir~�$T)r'�match�group�endr�rxrOrer�r)r�r�)rhr�patt�i�n�parsed_items�morsel_seen�TYPE_ATTRIBUTE�
TYPE_KEYVALUEr�rirqr��tpr�r�s                r�__parse_string�BaseCookie.__parse_string	s���
����H���������
�
�1�j�q�j�j��J�J�s�&�E������U�+�U�[�[��-?���	�	�!��A��1�v��}�"���#�#�^���W�e�$D�E������ 0� 0�0�"���=��y�y�{�f�m�m�3�$�+�+�^�$�,G�H�� �'�'��h�u�o�(N�O��"��#�#�]��9J�9J�5�9Q�$R�S�"���E�1�j�q�j�j�J
��*�N�B�U��#��}�$�}��#���*�*�*�"�
���
�
�3�d�+��I��+rr
rm)Nr�z
)rrr
rr�r�r�rjr�rgr�r�r�r�r��_CookiePatternr�rr
rrrr�sD��1����'�(� ��G�E�!��(6�:rrc�$�\rSrSrSrSrSrSrg)riFz�
SimpleCookie supports strings as cookie values.  When setting
the value using the dictionary assignment notation, SimpleCookie
calls the builtin str() to convert the value to a string.  Values
received from HTTP are kept as strings.
c��[U5U4$rm)r)r�s  rr��SimpleCookie.value_decodeMs����}�c�!�!rc�2�[U5nU[U54$rm)rrr�s   rr��SimpleCookie.value_encodePs���S����v�f�~�%�%rr
N)rrr
rr�r�r�rr
rrrrFs���"�&rr)*r��re�stringr��__all__r�r�r�r��	Exceptionr�
ascii_letters�digits�_LegalChars�_UnescapedCharsr��range�map�ordrr��compile�escape�	fullmatchrr�subr(r$r)�_weekdayname�
_monthnamerMrfrO�_LegalKeyChars�_LegalValueChars�ASCII�VERBOSEr�rr)r�s0r�<module>rs���NX�z
�
��
7���G�G�	�����
�X�X�
�
	�)�	�"�"�"�V�]�]�2�5G�G����/���E�#�J��#�c�#��.G�*H�H�J�H�1��(�Q�,��H�J�������H�e���I�v���
�
�
�7�R�Y�Y�{�%;�;�<�F�F�
�
6��z�z�8�9�=�=���/�6A��8�
��<�:�F�i8�T�i8�jB��!�G�+�����	���		�	�����"
���B�J�J�	�# ��.I��I�X&�:�&��C
Js�E:

?>