+
     Bi?N                     ^   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R t]P*                  ! R4      P4                  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,           ]PJ                  ]PL                  ,          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=\\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                       ] tR t^tRtR# )r    N)__name__
__module____qualname____firstlineno____static_attributes__r       #/usr/lib/python3.14/http/cookies.pyr   r      s    r   z!#$%&'*+-.^_`|~:z ()/<=>?@[]{}   z\%03o"\"\z\\z[%s]+c                v    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_key	translate_Translatorstrs   &r   _quoter      s1     {mC((
S]];//#55r   z\\(?:([0-3][0-7][0-7])|(.))c                 j    V ^,          '       d   \        \        V ^,          ^4      4      # V ^,          # )   )chrint)ms   &r   _unquote_replacer       s)    tt3qtQ<  tr   c                     V e   \        V 4      ^8  d   V # V ^ ,          R8w  g   V R,          R8w  d   V # V ^R p \        \        V 4      # )Nr   )len_unquote_subr    r   s   &r   _unquoter%      sO     {c#hl

1v}B3
 a)C (#..r   c           	      |    ^ 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(   )futureweekdayname	monthnamer(   r)   nowyearmonthdayhhmmsswdyzs   &&&            r   _getdater7      sE    !
&C-3CL-A*D""0OSE"2DbEF Fr   c                   P  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.
expirespathPathcommentCommentdomainDomainmax-agezMax-AgesecureSecurehttponlyHttpOnlyversionVersionsamesiteSameSitepartitionedPartitionedr   c                n    R ;V n         ;V n        V n        \        P	                  W P
                  4       R # N)_key_value_coded_valuedictupdate_reserved_defaultsselfs   &r   __init__Morsel.__init__  s,    6::	:DK$"3 	D112r   c                    V P                   # rM   )rN   rT   s   &r   key
Morsel.key  s    yyr   c                    V P                   # rM   )rO   rT   s   &r   valueMorsel.value  s    {{r   c                    V P                   # rM   )rP   rT   s   &r   coded_valueMorsel.coded_value!  s       r   c                    VP                  4       pWP                  9   g   \        R V: 24      h\        P	                  WV4       R# Invalid attribute N)lower	_reservedr   rQ   __setitem__)rU   KVs   &&&r   rf   Morsel.__setitem__%  s5    GGINN";<<!$r   Nc                    VP                  4       pWP                  9  d   \        R V: 24      h\        P	                  WV4      # )rc   )rd   re   r   rQ   
setdefault)rU   rY   vals   &&&r   rk   Morsel.setdefault+  s6    iiknn$=>>t#..r   c                *   \        V\        4      '       g   \        # \        P	                  W4      ;'       d\    V P
                  VP
                  8H  ;'       d;    V P                  VP                  8H  ;'       d    V P                  VP                  8H  # rM   )
isinstancer9   NotImplementedrQ   __eq__rO   rN   rP   rU   morsels   &&r   rq   Morsel.__eq__1  sz    &&))!!D) 9 9v}},9 9		V[[(9 9 !!V%8%88	:r   c                    \        4       p\        P                  W4       VP                  P                  V P                  4       V# rM   )r9   rQ   rR   __dict__rr   s   & r   copyMorsel.copy;  s0    F!t}}-r   c                    / 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# rb   )rQ   itemsrd   re   r   rR   )rU   valuesdatarY   rl   s   &&   r   rR   Morsel.updateA  sX    V**,HC))+C..(!C"ABBI	 -
 	Dr   c                <    VP                  4       V P                  9   # rM   )rd   re   )rU   rg   s   &&r   isReservedKeyMorsel.isReservedKeyJ  s    wwyDNN**r   c                    VP                  4       V P                  9   d   \        R V: 24      h\        V4      '       g   \        RV: 24      hWn        W n        W0n        R# )zAttempt to set a reserved key zIllegal key N)rd   re   r   r   rN   rO   rP   )rU   rY   rl   	coded_vals   &&&&r   set
Morsel.setM  sM    99;$..(CIJJS!!#788 	%r   c                N    R V P                   RV P                  RV P                  /# )rY   r\   r_   rN   rO   rP   rT   s   &r   __getstate__Morsel.__getstate__X  s)    499T[[4,,
 	
r   c                Z    VR ,          V n         VR,          V n        VR,          V n        R# )rY   r\   r_   Nr   )rU   states   &&r   __setstate__Morsel.__setstate___  s%    %L	Gn!-0r   c                2    V: R V P                  V4      : 2# )r   )OutputString)rU   attrsheaders   &&&r   outputMorsel.outputd  s     $"3"3E":;;r   c                \    R V P                   P                  : RV P                  4       : R2# )<: >)	__class__r	   r   rT   s   &r   __repr__Morsel.__repr__i  s     !^^44d6G6G6IJJr   c                R    R V P                  V4      P                  RR4      ,          # )z
        <script type="text/javascript">
        <!-- begin hiding
        document.cookie = "%s";
        // end hiding -->
        </script>
        r   r   )r   replace)rU   r   s   &&r   	js_outputMorsel.js_outputl  s.       '//U;= 	=r   c                j   . 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:   rA   z%s=%dr=   )appendrY   r_   re   sortedrz   ro   r   r7   r   r   _flags_semispacejoin)rU   r   resultr   rz   rY   r\   s   &&     r   r   Morsel.OutputStringv  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   )rP   rN   rO   >   rB   rD   rJ   rM   )NSet-Cookie:)%r	   r
   r   r   __doc__re   rQ   fromkeysrS   r   rV   propertyrY   r\   r_   rf   rk   rq   object__ne__rw   rR   r   r   r   r   r   __str__r   r   r   classmethodtypesGenericAlias__class_getitem__r   __classdictcell____classdict__s   @r   r9   r9      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   r9   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                   v   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                    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   rU   rl   s   &&r   value_decodeBaseCookie.value_decode  s     xr   c                    \        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   rU   rl   strvals   && r   value_encodeBaseCookie.value_encode  s     S~r   Nc                <    V'       d   V P                  V4       R # R # rM   )load)rU   inputs   &&r   rV   BaseCookie.__init__  s    IIe r   c                    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)getr9   r   rQ   rf   )rU   rY   
real_valuer_   Ms   &&&& r   __setBaseCookie.__set  s2    HHS&(#	c{+A&r   c                    \        V\        4      '       d   \        P                  WV4       R# V P	                  V4      w  r4V P                  WV4       R# )zDictionary style assignment.N)ro   r9   rQ   rf   r   _BaseCookie__set)rU   rY   r\   rvalcvals   &&&  r   rf   BaseCookie.__setitem__  s?    eV$$T.**51JDJJs$'r   c                    . p\        V P                  4       4      pV F%  w  rgVP                  VP                  W4      4       K'  	  VP	                  V4      # )z"Return a string suitable for HTTP.)r   rz   r   r   join)rU   r   r   sepr   rz   rY   r\   s   &&&&    r   r   BaseCookie.output  sG    tzz|$JCMM%,,u56  xxr   c                    . 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# )r   r   r   r   )r   rz   r   reprr\   r   r	   
_spacejoin)rU   lrz   rY   r\   s   &    r   r   BaseCookie.__repr__  sV    tzz|$JCHHT%++%678  !^^44jmDDr   c                    . 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.)r   rz   r   r   	_nulljoin)rU   r   r   rz   rY   r\   s   &&    r   r   BaseCookie.js_output  sC    tzz|$JCMM%//%01    r   c                    \        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)ro   r   _BaseCookie__parse_stringrz   )rU   rawdatarY   r\   s   &&  r   r   BaseCookie.load  sB     gs##(
 	 &mmo
!S	 .r   c                T   ^ 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'   FrY   rl   $:r   NNNT)r#   matchgroupendr   rd   r9   re   r   r%   r   r   )rU   r   pattinparsed_itemsmorsel_seenTYPE_ATTRIBUTETYPE_KEYVALUEr   rY   r\   r   tpr   r   s   &&&             r   __parse_string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   rM   )Nr   z
)r	   r
   r   r   r   r   r   rV   r   rf   r   r   r   r   r   _CookiePatternr   r   r   r   s   @r   r   r     sL     1'(  GE! (6 : :r   c                   0   a  ] tR tRt o RtR tR tRtV tR# )r   iJ  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                    \        V4      V3# rM   )r%   r   s   &&r   r   SimpleCookie.value_decodeQ  s    }c!!r   c                2    \        V4      pV\        V4      3# rM   )r   r   r   s   && r   r   SimpleCookie.value_encodeT  s    Svf~%%r   r   N)	r	   r
   r   r   r   r   r   r   r   r   s   @r   r   r   J  s     "& &r   )r   r   r   )MonTueWedThuFriSatSun)NJanFebMarAprMayJunJulAugSepOctNovDec)*r   restringr   __all__r   r   r   r   	Exceptionr   ascii_lettersdigits_LegalChars_UnescapedCharsr   rangemapordr   rR   compileescape	fullmatchr   r   subr$   r    r%   _weekdayname
_monthnamer7   rQ   r9   _LegalKeyChars_LegalValueCharsASCIIVERBOSEr   r   r   )r   s   0r   <module>r     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
6 zz89==/6 A8
 <: Fk8T k8n B!G+  	 		 & 
BJJ	' 2I IX&: &KJs   F*