+
    iQ  c                   s   R t ^ RIt^ RIt^ RIt. R"OtRP
                  tRP
                  tRP
                  t ! R R]	4      t
]P                  ]P                  ,           R	,           t]R
,           t]! ]! R4      4      ]! ]! ]]4      4      ,
           U u/ uF  p V RV ,          bK  	  up t]P)                  ]! R4      R]! R4      R/4       ]P*                  ! R]P,                  ! ]4      ,          4      P.                  t]P*                  ! R4      tR tR t]P*                  ! R4      P8                  tR tR t. R#Ot . R$Ot!^ ] ]!3R lt" ! R R]#4      t$Rt%]%R,           t&]P*                  ! R]%,           R,           ]&,           R,           ]PN                  ]PP                  ,          4      t) ! R  R]#4      t* ! R! R]*4      t+R# u up i )%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=;";')
   >>> print(C)
   Set-Cookie: keebler="E=everybody; L=\"Loves\"; fudge=;"

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                   s    ] tR t^tRtR# )r     N)__name__
__module____qualname____firstlineno____static_attributes__r       %/usr/lib64/python3.14/http/cookies.pyr    r       s    r   z!#$%&'*+-.^_`|~:z ()/<=>?@[]{}i   z\%03o"\"Z\z\\z[%s]+z[\x00-\x1F\x7F]c                 sj    \         ;QJ d    R V  4       F  '       g   K   R# 	  R# ! R V  4       4      # )z`Detects control characters within a value.
Supports any type, as header values can be any type.
c              3   s^   "   T F#  p\         P                  \        V4      4      x  K%  	  R # 5iN)_control_character_reZsearchstr)Z.0Zv   & r   Z	<genexpr>Z)_has_control_character.<locals>.<genexpr>   s#     AS$++CF33Ss   +-TF)Zany)vals   *r   _has_control_characterr      s-     3ASA33A3A3ASAAAr   c                sv    V e   \        V 4      '       d   V # RV P                  \        4      ,           R,           # )zQuote 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_keyZ	translate_Translatorr      &r   _quoter      s1     {mC((
S]];//#55r   z\\(?:([0-3][0-7][0-7])|(.))c                 sj    V ^,          '       d   \        \        V ^,          ^4      4      # V ^,          # )   )Zchrint)Zmr   r   _unquote_replacer      s)    tt3qtQ<  tr   c                 s    V e   \        V 4      ^8  d   V # V ^ ,          R8w  g   V R,          R8w  d   V # V ^R p \        \        V 4      # )Nr   i)len_unquote_subr   r   r   r   _unquoter      sO     {c#hl

1v}B3
 a)C (#..r   c           	      s|    ^ RI HpH p V! 4       pV! WP,           4      w	  rgrrrpRW,          WV,          WiW3,          # )    )gmtimetimez#%s, %02d %3s %4d %02d:%02d:%02d GMT)r"   r!   )ZfutureZweekdaynameZ	monthnamer!   r"   ZnowZyearZmonthZdayZhhZmmZssZwdZyZzs   &&&            r   _getdater#      sE    !
&C-3CL-A*D""0OSE"2DbEF Fr   c                   sP  a  ] tR t^t o RtRRRRRRRRR	R
RRRRRRRRRR/
t]P                  ]R4      t0 R)mt	R t
]R 4       t]R 4       t]R 4       tR tR*R ltR t]P&                  tR tR tR  tR! tR" tR# tR+R$ lt]tR% tR*R& ltR*R' lt]! ] PB                  4      t"R(t#V t$R# ),Morsela/  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.
expiresZpathZPathcommentZCommentZdomainZDomainmax-agezMax-AgesecureZSecurehttponlyZHttpOnlyZversionZVersionZsamesiteZSameSitepartitionedZPartitionedr   c                sn    R ;V n         ;V n        V n        \        P	                  W P
                  4       R # r   )_key_value_coded_valuedictupdate_reserved_defaultsselfr   r   __init__ZMorsel.__init__  s,    6::	:DK$"3 	D112r   c                    V P                   # r   )r+   r1   r   r   keyZ
Morsel.key"  s    yyr   c                r4   r   )r,   r1   r   r   valueZMorsel.value&  s    {{r   c                r4   r   )r-   r1   r   r   coded_valueZMorsel.coded_value*  s       r   c                s    VP                  4       pWP                  9   g   \        R V: 24      h\        W4      '       d   \        RV: RV: 24      h\        P                  WV4       R# )Invalid attribute .Control characters are not allowed in cookies r   N)lower	_reservedr    r   r.   __setitem__)r2   KZV   &&&r   r<   ZMorsel.__setitem__.  s\    GGINN";<<!!'' NqeSTUVTYZ[[!$r   Nc                s    VP                  4       pWP                  9  d   \        R V: 24      h\        W4      '       d   \        RV: RV: 24      h\        P                  WV4      # )r8   r9   r   )r:   r;   r    r   r.   
setdefault)r2   r5   r   r>   r   r?   ZMorsel.setdefault6  sS    iiknn$=>>!#++WZ\_abbt#..r   c                s*   \        V\        4      '       g   \        # \        P	                  W4      ;'       d\    V P
                  VP
                  8H  ;'       d;    V P                  VP                  8H  ;'       d    V P                  VP                  8H  # r   )
isinstancer$   ZNotImplementedr.   __eq__r,   r+   r-   r2   Zmorsel   &&r   rA   ZMorsel.__eq__>  sz    &&))!!D) 9 9v}},9 9		V[[(9 9 !!V%8%88	:r   c                s    \        4       p\        P                  W4       VP                  P                  V P                  4       V# r   )r$   r.   r/   Z__dict__rB   r   r   copyZMorsel.copyH  s0    F!t}}-r   c                s    / p\        V4      P                  4        F8  w  r4VP                  4       pW0P                  9  d   \	        R V: 24      hWBV&   K:  	  \         P                  W4       R# )r8   N)r.   itemsr:   r;   r    r/   )r2   ZvaluesZdatar5   r   s   &&   r   r/   ZMorsel.updateN  sX    V**,HC))+C..(!C"ABBI	 -
 	Dr   c                s<    VP                  4       V P                  9   # r   )r:   r;   )r2   r=   rC   r   isReservedKeyZMorsel.isReservedKeyW  s    wwyDNN**r   c                s   VP                  4       V P                  9   d   \        R V: 24      h\        V4      '       g   \        RV: 24      h\	        WV4      '       d   \        RV: RV: RV: 24      hWn        W n        W0n        R# )zAttempt to set a reserved key zIllegal key r9   r   N)r:   r;   r    r   r   r+   r,   r-   )r2   r5   r   Z	coded_vals   &&&&r   setZ
Morsel.setZ  su    99;$..(CIJJS!!#788!#I66LOQTV_ac c 	%r   c                sN    R V P                   RV P                  RV P                  /# )r5   r6   r7   r+   r,   r-   r1   r   r   __getstate__ZMorsel.__getstate__h  s)    499T[[4,,
 	
r   c                sZ    VR ,          V n         VR,          V n        VR,          V n        R# )r5   r6   r7   NrH   )r2   ZstaterC   r   __setstate__ZMorsel.__setstate__o  s%    %L	Gn!-0r   c                s2    V: R V P                  V4      : 2# )r   )OutputString)r2   attrsheaderr>   r   outputZMorsel.outputt  s     $"3"3E":;;r   c                s\    R V P                   P                  : RV P                  4       : R2# )<: >)	__class__r   rK   r1   r   r   __repr__ZMorsel.__repr__y  s     !^^44d6G6G6IJJr   c                sR    R V P                  V4      P                  RR4      ,          # )z
        <script type="text/javascript">
        <!-- begin hiding
        document.cookie = "%s";
        // end hiding -->
        </script>
        r   r   )rK   Zreplace)r2   rL   rC   r   	js_outputZMorsel.js_output|  s.       '//U;= 	=r   c                sj   . pVP                   pV! V P                  : R V P                  : 24       Vf   V P                  p\	        V P                  4       4      pV EFH  w  rVVR8X  d   K  WQ9  d   K  VR8X  dB   \        V\        4      '       d,   V! V P                  V,          : R \        V4      : 24       K_  VR8X  d;   \        V\        4      '       d%   V! RV P                  V,          V3,          4       K  VR8X  dB   \        V\        4      '       d,   V! V P                  V,          : R \        V4      : 24       K  WPP                  9   d1   V'       d&   V! \        V P                  V,          4      4       EK%  EK(  V! V P                  V,          : R V: 24       EKK  	  \        V4      # )=r   r%   r'   z%s=%dr&   )appendr5   r7   r;   sortedrE   r@   r   r#   r   r   _flags_semispacejoin)r2   rL   resultrV   rE   r5   r6   s   &&     r   rK   ZMorsel.OutputString  sK     	$((D$4$456 =NNEtzz|$JC{iJuc$:$:$.."5"5xGH	!j&<&<w$.."5u!==>	!j&<&<$.."5"5ve}EF#3t~~c234  $.."5"5u=>  $ f%%r   )r-   r+   r,   >   r(   r)   r*   r   )NSet-Cookie:)%r   r   r   r	   __doc__r;   r.   Zfromkeysr0   rX   r3   Zpropertyr5   r6   r7   r<   r?   rA   ZobjectZ__ne__rD   r/   rF   rG   rI   rJ   rN   __str__rS   rT   rK   ZclassmethodtypesZGenericAliasZ__class_getitem__r
   __classdictcell__Z__classdict__   @r   r$   r$      s    * 	YVYXYXZYZ}I y"52F3     ! !%/: ]]F +&
1
< GK=&B $E$6$67r   r$   z,\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=z\[\]z
    \s*                            # Optional whitespace at start of cookie
    (?P<key>                       # Start of group 'key'
    [ax  ]+?   # 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 double-quoted string
    |                                  # or
    # Special case for "expires" attr
    (\w{3,6}day|\w{3}),\s              # Day of the week or abbreviated day
    [\w\d\s-]{9,11}\s[\d:]{8}\sGMT     # Date and time in specific format
    |                                  # 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                   sv   a  ] tR tRt o RtR tR tRR ltR tR t	RR	 lt
]
tR
 tRR ltR t]3R ltRtV tR# )r   i  z'A container class for a set of Morsels.c                s    W3# )zreal_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   r2   r   rC   r   value_decodeZBaseCookie.value_decode  s     xr   c                s    \        V4      pW"3# )zreal_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   r2   r   Zstrval   && r   value_encodeZBaseCookie.value_encode  s     S~r   Nc                s<    V'       d   V P                  V4       R # R # r   )load)r2   ZinputrC   r   r3   ZBaseCookie.__init__  s    IIe r   c                s    V P                  V\        4       4      pVP                  WV4       \        P	                  WV4       R# )z+Private method for setting a cookie's valueN)Zgetr$   rG   r.   r<   )r2   r5   Z
real_valuer7   Ms   &&&& r   Z__setZBaseCookie.__set  s2    HHS&(#	c{+A&r   c                s    \        V\        4      '       d   \        P                  WV4       R# V P	                  V4      w  r4V P                  WV4       R# )zDictionary style assignment.N)r@   r$   r.   r<   rf   _BaseCookie__set)r2   r5   r6   rvalcvals   &&&  r   r<   ZBaseCookie.__setitem__  s?    eV$$T.**51JDJJs$'r   c                s    . p\        V P                  4       4      pV FC  w  rgVP                  W4      p\        V4      '       d   \	        R4      hVP                  V4       KE  	  VP                  V4      # )z"Return a string suitable for HTTP.z-Control characters are not allowed in cookies)rW   rE   rN   r   r    rV   join)	r2   rL   rM   ZseprZ   rE   r5   r6   Zvalue_outputs	   &&&&     r   rN   ZBaseCookie.output  se    tzz|$JC <<6L%l33!"QRRMM,'	  
 xxr   c                s    . p\        V P                  4       4      pV F0  w  r4VP                  V: R \        VP                  4      : 24       K2  	  RV P
                  P                  : R\        V4      : R2# )rU   rO   rP   rQ   )rW   rE   rV   Zreprr6   rR   r   
_spacejoin)r2   ZlrE   r5   r6   s   &    r   rS   ZBaseCookie.__repr__  sV    tzz|$JCHHT%++%678  !^^44jmDDr   c                s    . p\        V P                  4       4      pV F%  w  rEVP                  VP                  V4      4       K'  	  \	        V4      # )z(Return a string suitable for JavaScript.)rW   rE   rV   rT   	_nulljoin)r2   rL   rZ   rE   r5   r6   s   &&    r   rT   ZBaseCookie.js_output
  sC    tzz|$JCMM%//%01    r   c                s    \        V\        4      '       d   V P                  V4       R# VP                  4        F	  w  r#W0V&   K  	  R# )zLoad 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_stringrE   )r2   Zrawdatar5   r6   s   &&  r   rg   ZBaseCookie.load  sB     gs##(
 	 &mmo
!S	 .r   c                sT   ^ p\        V4      p. pRp^p^p^ Tu;8:  d	   V8  Ed=   M EM8VP                  W4      p	V	'       g   EMV	P                  R4      V	P                  R4      rV	P                  ^ 4      pV
^ ,          R8X  d'   V'       g   Ky  VP	                  WzR,          V34       K  V
P                  4       \        P                  9   dh   V'       g   R# Vf;   V
P                  4       \        P                  9   d   VP	                  WzR34       K  R# VP	                  Wz\        V4      34       EK  Ve(   VP	                  WV P                  V4      34       RpEKJ  R# RpV F>  w  rpW8X  d   Vf   Q hWV
&   K  W8X  g   Q hVw  rV P                  WV4       W
,          pK@  	  R# )r    Fr5   r   Z$:r   NNNT)r   matchZgroupZendrV   r:   r$   r;   rX   r   rc   ri   )r2   r   ZpattZinZparsed_itemsZmorsel_seenZTYPE_ATTRIBUTEZTYPE_KEYVALUErp   r5   r6   rh   Ztprj   rk   s   &&&             r   Z__parse_stringZBaseCookie.__parse_string   sy   H
 1jqjjJJs&EU+U[[-?		!A1v}" ##^We$DE 0 00"=yy{fmm3$++^$,GH  ''huo(NO"##]9J9J59Q$RS"  *NBU#}$}#***"


3d+I +r   r   r   )Nr[   z
)r   r   r   r	   r\   rc   rf   r3   ri   r<   rN   r]   rS   rT   rg   _CookiePatternro   r
   r_   r`   ra   r   r   r     sL     1'(	  GE! (6 : :r   c                   s0   a  ] tR tRt o RtR tR tRtV tR# )r   i]  z
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                s    \        V4      V3# r   )r   rb   rC   r   rc   ZSimpleCookie.value_decoded  s    }c!!r   c                s2    \        V4      pV\        V4      3# r   )r   r   rd   re   r   rf   ZSimpleCookie.value_encodeg  s    Svf~%%r   r   N)	r   r   r   r	   r\   rc   rf   r
   r_   r`   ra   r   r   r   ]  s     "& &r   )r    r   r   )ZMonZTueZWedZThuZFriZSatZSun)NZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDec),r\   ZreZstringr^   Z__all__rl   rn   rY   rm   Z	Exceptionr    Zascii_lettersZdigitsZ_LegalCharsZ_UnescapedCharsrG   ZrangeZmapZordr   r/   ZcompileZescapeZ	fullmatchr   r   r   r   Zsubr   r   r   Z_weekdaynameZ
_monthnamer#   r.   r$   Z_LegalKeyCharsZ_LegalValueCharsZASCIIZVERBOSErr   r   r   )rq   s   0r   <module>rs      s  NXz 
  
7GG	XX

	) 	" ""V]]25GG/ E#J#c#.G*HHJH1 (Q,HJ   HeIv 
 

7RYY{%;;<FF

#56 B
6 zz89==/6 A8
 <: Fr8T r8| B!G+  	 		 & 
BJJ	' 2L L^&: &qJs   F?