/usr/lib64/python3.9/http/__pycache__
NameSizeModeActions
client.cpython-39.opt-1.pyc354660644editdlrm
client.cpython-39.opt-2.pyc259380644editdlrm
client.cpython-39.pyc355390644editdlrm
cookiejar.cpython-39.opt-1.pyc533480644editdlrm
cookiejar.cpython-39.opt-2.pyc377110644editdlrm
cookiejar.cpython-39.pyc535050644editdlrm
cookies.cpython-39.opt-1.pyc150290644editdlrm
cookies.cpython-39.opt-2.pyc106320644editdlrm
cookies.cpython-39.pyc150610644editdlrm
server.cpython-39.opt-1.pyc350320644editdlrm
server.cpython-39.opt-2.pyc229860644editdlrm
server.cpython-39.pyc350320644editdlrm
__init__.cpython-39.opt-1.pyc64130644editdlrm
__init__.cpython-39.opt-2.pyc55540644editdlrm
__init__.cpython-39.pyc64130644editdlrm
Edit: /usr/lib64/python3.9/http/__pycache__/cookies.cpython-39.opt-1.pyc (15029B)
a ´i€Mã@sZdZddlZddlZddlZgd¢ZdjZdjZdjZGdd„de ƒZ ej ej d Z e d Zd d „eed ƒƒeeeeƒƒDƒZe edƒdedƒdi¡e de e ¡¡jZdd„Ze d¡jZdd„Zdd„Zgd¢Zgd¢Zdeefdd„Z Gdd„de!ƒZ"d Z#e#d!Z$e d"e#d#e$d$ej%ej&B¡Z'Gd%d&„d&e!ƒZ(Gd'd(„d(e(ƒZ)dS))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@s eZdZdS)rN)Ú__name__Ú __module__Ú __qualname__©r r ú$/usr/lib64/python3.9/http/cookies.pyr‘srz!#$%&'*+-.^_`|~:z ()/<=>?@[]{}cCsi|]}|d|“qS)z\%03or )Ú.0Únr r r Ú ¥sÿréú"ú\"ú\z\\z[%s]+cCs*|dust|ƒr|Sd| t¡dSdS)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. Nr)Ú _is_legal_keyÚ translateÚ _Translator©Ústrr r r Ú_quote®srz\\(?:([0-3][0-7][0-7])|(.))cCs&|drtt|ddƒƒS|dSdS)Nééé)ÚchrÚint)Úmr r r Ú_unquote_replace½srcCsJ|dust|ƒdkr|S|ddks0|ddkr4|S|dd…}tt|ƒS)Nrrréÿÿÿÿr)ÚlenÚ _unquote_subrrr r r Ú_unquoteÃs  r#)ZMonZTueZWedZThuZFriZSatZSun) NZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDecc CsRddlm}m}|ƒ}|||ƒ\ }}}} } } } } }d|| ||||| | | fS)Nr)ÚgmtimeÚtimez#%s, %02d %3s %4d %02d:%02d:%02d GMT)r%r$)ÚfutureZ weekdaynameZ monthnamer$r%ZnowZyearZmonthZdayZhhZmmÚssZwdÚyÚzr r r Ú_getdateäs ÿr*c @sàeZdZdZdddddddd d d œ Zd d hZdd„Zedd„ƒZedd„ƒZ edd„ƒZ dd„Z d2dd„Z dd„Z ejZdd„Zdd „Zd!d"„Zd#d$„Zd%d&„Zd'd(„Zd3d*d+„ZeZd,d-„Zd4d.d/„Zd5d0d1„ZeejƒZdS)6ÚMorselaCA 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ÚCommentZDomainzMax-AgeZSecureZHttpOnlyZVersionZSameSite) r,ÚpathÚcommentÚdomainúmax-ageÚsecureÚhttponlyÚversionZsamesiter3r4cCs0d|_|_|_|jD]}t ||d¡qdS)Nr)Ú_keyÚ_valueÚ _coded_valueÚ _reservedÚdictÚ __setitem__)ÚselfÚkeyr r r Ú__init__s zMorsel.__init__cCs|jS©N)r6©r<r r r r=sz Morsel.keycCs|jSr?)r7r@r r r Úvaluesz Morsel.valuecCs|jSr?)r8r@r r r Ú coded_valueszMorsel.coded_valuecCs2| ¡}||jvr td|fƒ‚t |||¡dS©NzInvalid attribute %r)Úlowerr9rr:r;)r<ÚKÚVr r r r;#s zMorsel.__setitem__NcCs.| ¡}||jvr td|fƒ‚t |||¡SrC)rDr9rr:Ú setdefault)r<r=Úvalr r r rG)s zMorsel.setdefaultcCs>t|tƒstSt ||¡o<|j|jko<|j|jko<|j|jkSr?)Ú isinstancer+ÚNotImplementedr:Ú__eq__r7r6r8©r<Zmorselr r r rK/s   ÿ þ ýz Morsel.__eq__cCs$tƒ}t ||¡|j |j¡|Sr?)r+r:ÚupdateÚ__dict__rLr r r Úcopy9s z Morsel.copycCsRi}t|ƒ ¡D]0\}}| ¡}||jvr8td|fƒ‚|||<qt ||¡dSrC)r:ÚitemsrDr9rrM)r<ÚvaluesÚdatar=rHr r r rM?s  z Morsel.updatecCs| ¡|jvSr?)rDr9)r<rEr r r Ú isReservedKeyHszMorsel.isReservedKeycCsH| ¡|jvrtd|fƒ‚t|ƒs2td|fƒ‚||_||_||_dS)Nz Attempt to set a reserved key %rzIllegal key %r)rDr9rrr6r7r8)r<r=rHZ coded_valr r r ÚsetKsz Morsel.setcCs|j|j|jdœS)N)r=rArB©r6r7r8r@r r r Ú __getstate__VsýzMorsel.__getstate__cCs"|d|_|d|_|d|_dS)Nr=rArBrU)r<Ústater r r Ú __setstate__]s  zMorsel.__setstate__ú Set-Cookie:cCsd|| |¡fS)Nz%s %s)Ú OutputString)r<ÚattrsÚheaderr r r Úoutputbsz Morsel.outputcCsd|jj| ¡fS)Nú<%s: %s>)Ú __class__rrZr@r r r Ú__repr__gszMorsel.__repr__cCsd| |¡ dd¡S)Nz— rr)rZÚreplace)r<r[r r r Ú js_outputjsúzMorsel.js_outputcCs$g}|j}|d|j|jfƒ|dur,|j}t| ¡ƒ}|D]Þ\}}|dkrNq<||vrXq<|dkr†t|tƒr†|d|j|t|ƒfƒq<|dkr°t|tƒr°|d|j||fƒq<|dkrÞt|t ƒrÞ|d|j|t |ƒfƒq<||j v�r|�r|t |j|ƒƒq<|d|j||fƒqÚpropertyr=rArBr;rGrKÚobjectÚ__ne__rOrMrSrTrVrXr]Ú__str__r`rbrZÚ classmethodÚtypesÚ GenericAliasÚ__class_getitem__r r r r r+ìsF÷         !r+z,\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=z\[\]zŒ \s* # Optional whitespace at start of cookie (?P # 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 # 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@sneZdZdZdd„Zdd„Zddd„Zd d „Zd d „Zddd„Z e Z dd„Z ddd„Z dd„Z efdd„ZdS)rz'A container class for a set of Morsels.cCs||fS)a 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 ©r<rHr r r Ú value_decode½szBaseCookie.value_decodecCst|ƒ}||fS)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©r<rHZstrvalr r r Ú value_encodeÆszBaseCookie.value_encodeNcCs|r| |¡dSr?)Úload)r<Úinputr r r r>ÏszBaseCookie.__init__cCs.| |tƒ¡}| |||¡t |||¡dS)z+Private method for setting a cookie's valueN)Úgetr+rTr:r;)r<r=Z real_valuerBÚMr r r Z__setÓszBaseCookie.__setcCs:t|tƒrt |||¡n| |¡\}}| |||¡dS)zDictionary style assignment.N)rIr+r:r;ruÚ_BaseCookie__set)r<r=rAÚrvalÚcvalr r r r;Ùs zBaseCookie.__setitem__rYú cCs:g}t| ¡ƒ}|D]\}}| | ||¡¡q| |¡S)z"Return a string suitable for HTTP.)rerPrdr]Újoin)r<r[r\ÚseprhrPr=rAr r r r]âs   zBaseCookie.outputcCsJg}t| ¡ƒ}|D] \}}| d|t|jƒf¡qd|jjt|ƒfS)Nrcr^)rerPrdÚreprrAr_rÚ _spacejoin)r<ÚlrPr=rAr r r r`ìs   zBaseCookie.__repr__cCs6g}t| ¡ƒ}|D]\}}| | |¡¡qt|ƒS)z(Return a string suitable for JavaScript.)rerPrdrbÚ _nulljoin)r<r[rhrPr=rAr r r rbós   zBaseCookie.js_outputcCs4t|tƒr| |¡n| ¡D]\}}|||<qdS)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)rIrÚ_BaseCookie__parse_stringrP)r<Zrawdatar=rAr r r rvûs    zBaseCookie.loadcCshd}t|ƒ}g}d}d}d}d|kr2|k�rnnæ| ||¡} | sJ�q|  d¡|  d¡} } |  d¡}| ddkr–|s|q| || dd…| f¡q|  ¡tjvrð|s¬dS| durÚ|  ¡tjvrÔ| || df¡qîdSn| || t | ƒf¡q| du�r| || |  | ¡f¡d}qdSqd} |D]>\} } } | |k�rB| | | <n| \}}|  | ||¡|| } �q$dS) NrFrrr=rHú$T) r!ÚmatchÚgroupÚendrdrDr+r9rfr#rsrz)r<rZpattÚir Z parsed_itemsZ morsel_seenZTYPE_ATTRIBUTEZ TYPE_KEYVALUEr†r=rAryÚtpr{r|r r r Z__parse_string sF      zBaseCookie.__parse_string)N)NrYr})N)rrr rirsrur>rzr;r]rmr`rbrvÚ_CookiePatternr„r r r r rºs    rc@s eZdZdZdd„Zdd„ZdS)rzþ 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. cCs t|ƒ|fSr?)r#rrr r r rsMszSimpleCookie.value_decodecCst|ƒ}|t|ƒfSr?)rrrtr r r ruPszSimpleCookie.value_encodeN)rrr rirsrur r r r rFsr)*riÚreÚstringroÚ__all__r~rƒrgr�Ú ExceptionrÚ ascii_lettersÚdigitsZ _LegalCharsZ_UnescapedCharsrTÚrangeÚmapÚordrrMÚcompileÚescapeÚ fullmatchrrÚsubr"rr#Z _weekdaynameZ _monthnamer*r:r+Z_LegalKeyCharsZ_LegalValueCharsÚASCIIÚVERBOSEr‹rrr r r r Ú'sV]ÿþ 6ýý ô ô ï