Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325
3 N”ªj]Wã @sŽdZddlZddlZdddgZdjZdjZdjZd d „ZGd d„de ƒZ ej ej d Z e d Zdd„eedƒƒeeeeƒƒDƒZejedƒdedƒdiƒejdeje ƒƒjZejdƒZdd„Zdd„ZejdƒjZdd„Zdd„Zd d!d"d#d$d%d&gZ dd'd(d)d*d+d,d-d.d/d0d1d2g Z!de e!fd3d4„Z"Gd5d6„d6e#ƒZ$d7Z%e%d8Z&ejd9e%d:e&d;ej'ej(BƒZ)Gda% 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; ú cCs$ddl}d|}|j|tdd�dS)NrzvThe .%s setter is deprecated. The attribute will be read-only in future releases. Please use the set() method instead.é)Ú stacklevel)ÚwarningsÚwarnÚDeprecationWarning)Úsetterr Úmsg©rú/usr/lib64/python3.6/cookies.pyÚ_warn_deprecated_setter�src@s eZdZdS)rN)Ú__name__Ú __module__Ú __qualname__rrrrr–sz!#$%&'*+-.^_`|~:z ()/<=>?@[]{}cCsi|]}d||“qS)z\%03or)Ú.0Únrrrú ªsréú"z\"ú\z\\z[%s]+z[\x00-\x1F\x7F]cGstdd„|DƒƒS)zhDetects control characters within a value. Supports any type, as header values can be any type. css|]}tjt|ƒƒVqdS)N)Ú_control_character_reÚsearchÚstr)rÚvrrrú ¹sz)_has_control_character..)Úany)ÚvalrrrÚ_has_control_characterµsr!cCs*|dkst|ƒr|Sd|jtƒ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)rrrrÚ_quote¼sr%z\\(?:([0-3][0-7][0-7])|(.))cCs&|drtt|ddƒƒS|dSdS)Nééé)ÚchrÚint)ÚmrrrÚ_unquote_replaceËsr,cCsJ|dkst|ƒdkr|S|ddks0|ddkr4|S|dd…}tt|ƒS)Nr(rrr&éÿÿÿÿr-)ÚlenÚ _unquote_subr,)rrrrÚ_unquoteÑs  r0ZMonZTueZWedZThuZFriZSatZSunZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDecc CsRddlm}m}|ƒ}|||ƒ\ }}}} } } } } }d|| ||||| | | fS)Nr)ÚgmtimeÚtimez#%s, %02d %3s %4d %02d:%02d:%02d GMT)r2r1)ZfutureZ weekdaynameZ monthnamer1r2ZnowZyearZmonthZdayZhhZmmZssZwdÚyÚzrrrÚ_getdateòs r5c @s eZdZdZdddddddd d œZd d hZd d„Zedd„ƒZej dd„ƒZedd„ƒZ e j dd„ƒZ edd„ƒZ e j dd„ƒZ dd„Z d6dd„Z dd„ZejZdd „Zd!d"„Zd#d$„Zd%d&„Zefd'd(„Zd)d*„Zd+d,„Zd7d.d/„ZeZd0d1„Zd8d2d3„Zd9d4d5„ZdS):Ú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. This is most useful when Python objects are pickled for network transit. ÚexpiresZPathÚCommentZDomainzMax-AgeZSecureZHttpOnlyZVersion)r7ÚpathÚcommentZdomainzmax-ageÚsecureÚhttponlyÚversionr;r<cCs4d|_|_|_x|jD]}tj||dƒqWdS)Nr)Ú_keyÚ_valueÚ _coded_valueÚ _reservedÚdictÚ __setitem__)ÚselfÚkeyrrrÚ__init__s zMorsel.__init__cCs|jS)N)r>)rDrrrrE%sz Morsel.keycCstdƒ||_dS)NrE)rr>)rDrErrrrE)scCs|jS)N)r?)rDrrrÚvalue.sz Morsel.valuecCstdƒ||_dS)NrG)rr?)rDrGrrrrG2scCs|jS)N)r@)rDrrrÚ coded_value7szMorsel.coded_valuecCstdƒ||_dS)NrH)rr@)rDrHrrrrH;scCsP|jƒ}||jkr td|fƒ‚t||ƒr>td|›d|›�ƒ‚tj|||ƒdS)NzInvalid attribute %rz.Control characters are not allowed in cookies r)ÚlowerrArr!rBrC)rDÚKÚVrrrrC@s   zMorsel.__setitem__NcCsH|jƒ}||jkr td|fƒ‚t||ƒr:td||fƒ‚tj|||ƒS)NzInvalid attribute %rz3Control characters are not allowed in cookies %r %r)rIrArr!rBÚ setdefault)rDrEr rrrrLHs   zMorsel.setdefaultcCs>t|tƒstStj||ƒo<|j|jko<|j|jko<|j|jkS)N)Ú isinstancer6ÚNotImplementedrBÚ__eq__r?r>r@)rDÚmorselrrrrOPs     z Morsel.__eq__cCs$tƒ}tj||ƒ|jj|jƒ|S)N)r6rBÚupdateÚ__dict__)rDrPrrrÚcopyZs z Morsel.copycCsti}x^t|ƒjƒD]N\}}|jƒ}||jkr:td|fƒ‚t||ƒrXtd|›d|›�ƒ‚|||<qWtj||ƒdS)NzInvalid attribute %rz.Control characters are not allowed in cookies r)rBÚitemsrIrArr!rQ)rDÚvaluesÚdatarEr rrrrQ`s   z Morsel.updatecCs|j|ƒ|S)N)rQ)rDrUrrrÚ__ior__ls zMorsel.__ior__cCs|jƒ|jkS)N)rIrA)rDrJrrrÚ isReservedKeypszMorsel.isReservedKeycCs†|tkr ddl}|jdtdd�|jƒ|jkrr?r@)rDrEr Z coded_valZ LegalCharsr rrrÚsetss  z Morsel.setcCs|j|j|jdœS)N)rErGrH)r>r?r@)rDrrrÚ __getstate__ˆszMorsel.__getstate__cCsT|d}|d}|d}t|||ƒr>td|›d|›d|›�ƒ‚||_||_||_dS)NrErGrHz.Control characters are not allowed in cookies r)r!rr>r?r@)rDÚstaterErGrHrrrÚ __setstate__�s zMorsel.__setstate__ú Set-Cookie:cCsd||j|ƒfS)Nz%s %s)Ú OutputString)rDÚattrsÚheaderrrrÚoutputšsz Morsel.outputcCsd|jj|jƒfS)Nz<%s: %s>)Ú __class__rr_)rDrrrÚ__repr__ŸszMorsel.__repr__cCs*|j|ƒ}t|ƒrtdƒ‚d|jddƒS)Nz-Control characters are not allowed in cookiesz— rz\")r_r!rÚreplace)rDr`Z output_stringrrrÚ js_output¢s zMorsel.js_outputcCs(g}|j}|d|j|jfƒ|dkr,|j}t|jƒƒ}xæ|D]Þ\}}|dkrPq>||krZq>|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 k�r|�r|t |j|ƒƒq>|d|j||fƒq>Wt |ƒS)Nz%s=%srr7zmax-agez%s=%dr:) ÚappendrErHrAÚsortedrTrMr*r5rr%Ú_flagsÚ_semispacejoin)rDr`ÚresultrgrTrErGrrrr_¯s,  zMorsel.OutputString)N)Nr^)N)N)rrrÚ__doc__rArirFÚpropertyrEr rGrHrCrLrOÚobjectÚ__ne__rSrQrWrXrYrZr[r]rbÚ__str__rdrfr_rrrrr6úsB        r6z,\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)rDr rrrÚ 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)rDr ÚstrvalrrrÚ value_encodeÿszBaseCookie.value_encodeNcCs|r|j|ƒdS)N)Úload)rDÚinputrrrrFszBaseCookie.__init__cCs.|j|tƒƒ}|j|||ƒtj|||ƒdS)z+Private method for setting a cookie's valueN)Úgetr6rZrBrC)rDrEZ real_valuerHÚMrrrZ__set szBaseCookie.__setcCs:t|tƒrtj|||ƒn|j|ƒ\}}|j|||ƒdS)zDictionary style assignment.N)rMr6rBrCrsÚ_BaseCookie__set)rDrErGÚrvalÚcvalrrrrCs zBaseCookie.__setitem__ú Set-Cookie:ú c CsRg}t|jƒƒ}x6|D].\}}|j||ƒ}t|ƒr:tdƒ‚|j|ƒqW|j|ƒS)z"Return a string suitable for HTTP.z-Control characters are not allowed in cookies)rhrTrbr!rrgÚjoin) rDr`raÚseprkrTrErGZ value_outputrrrrbs  zBaseCookie.outputcCsNg}t|jƒƒ}x(|D] \}}|jd|t|jƒfƒqWd|jjt|ƒfS)Nz%s=%sz<%s: %s>)rhrTrgÚreprrGrcrÚ _spacejoin)rDÚlrTrErGrrrrd(s  zBaseCookie.__repr__cCs:g}t|jƒƒ}x |D]\}}|j|j|ƒƒqWt|ƒS)z(Return a string suitable for JavaScript.)rhrTrgrfÚ _nulljoin)rDr`rkrTrErGrrrrf/s  zBaseCookie.js_outputcCs8t|tƒr|j|ƒnx|jƒD]\}}|||<q WdS)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)rMrÚ_BaseCookie__parse_stringrT)rDZrawdatarErGrrrrt7s    zBaseCookie.loadcCsŒd}t|ƒ}g}d}d}d}�xd|ko2|kn�r|j||ƒ} | sLP| jdƒ| jdƒ} } | jdƒ}| ddkr˜|s~q |j|| dd…| fƒq | jƒtjkrò|s®dS| dkrÜ| jƒtjkrÖ|j|| dfƒqðdSn|j|| t | ƒfƒq | dk �r|j|| |j | ƒfƒd}q dSq Wd} xb|D]Z\} } } | |k�rV| dk �sLt ‚| | | <n,| |k�sdt ‚| \}}|j | ||ƒ|| } �q*WdS) NrFr&r(rEr ú$T) r.ÚmatchÚgroupÚendrgrIr6rArir0rqÚAssertionErrorrx)rDrZpattÚirZ parsed_itemsZ morsel_seenZTYPE_ATTRIBUTEZ TYPE_KEYVALUEr…rErGrwÚtpryrzrrrZ__parse_stringEsJ      zBaseCookie.__parse_string)N)Nr{r|)N)rrrrlrqrsrFrxrCrbrprdrfrtÚ_CookiePatternrƒrrrrrós    c@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|ƒ|fS)N)r0)rDr rrrrq‰szSimpleCookie.value_decodecCst|ƒ}|t|ƒfS)N)rr%)rDr rrrrrrsŒszSimpleCookie.value_encodeN)rrrrlrqrsrrrrr‚s),rlÚreÚstringÚ__all__r}r‚rjr€rÚ ExceptionrZ ascii_lettersZdigitsrYZ_UnescapedCharsrZÚrangeÚmapÚordr$rQÚcompileÚescapeÚ fullmatchr"rr!r%Úsubr/r,r0Z _weekdaynameZ _monthnamer5rBr6Z_LegalKeyCharsZ_LegalValueCharsÚASCIIÚVERBOSEr‹rrrrrrÚsJ     a