6X d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZmZm Z m
Z
ddlmZm
Z
ddlZerde_ ddlZg d Zd
j Zdj Zdj Z G d
de Zej ej z dz Zi ddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1i d2d3d4d5d6d7d8d9d:d;dd?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSi dTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdui dvdwdxdydzd{d|d}d~dddddddddddddddddddddddddi ddddddddddddddddddddddddddddddddddi ddddddddddÓddœddǓddɓdd˓dd͓ddϓddѓddӓddՓddדddٓddۓi ddݓddߓddddddddddddddddddddddddddddddi ddd ddddddddd d
ddd
ddddddddddddddddddi d d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNZefdOZ ej dP Z ej dQ ZdR Z g dSZ!g dTZ"de!e"fdUZ# G dV dWe Z$dXZ% ej dYe%z dZz e%z d[z ej Z& G d\ d]e Z' G d^ d_e' Z(dS (` af
http.cookies module ported to python-future from Py3.3
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.
)unicode_literals)print_function)division)absolute_import)chrdictintstr)PY2
as_native_strN)CookieError
BaseCookieSimpleCookie z; c e Zd ZdS )r
N)__name__
__module____qualname__ o/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/future/backports/http/cookies.pyr
r
s Dr r
z!#$%&'*+-.^_`|~: z\000z\001z\002z\003z\004z\005z\006z\007z\010 z\011
z\012z\013z\014
z\015z\016z\017z\020z\021z\022z\023z\024z\025z\026z\027z\030z\031z\032z\033z\034z\035z\036z\037,z\054;z\073"\"\z\\z\177 z\200 z\201 z\202 z\203 z\204
z\205 z\206 z\207 z\210 z\211 z\212 z\213 z\214 z\215 z\216 z\217 z\220 z\221 z\222 z\223 z\224 z\225 z\226 z\227 z\230 z\231 z\232 z\233 z\234 z\235 z\236 z\237 z\240 ¡z\241 ¢z\242 £z\243 ¤z\244 ¥z\245 ¦z\246 §z\247 ¨z\250 ©z\251 ªz\252 «z\253 ¬z\254 z\255 ®z\256 ¯z\257 °z\260 ±z\261 ²z\262 ³z\263 ´z\264 µz\265 ¶z\266 ·z\267 ¸z\270 ¹z\271 ºz\272 »z\273 ¼z\274 ½z\275 ¾z\276 ¿z\277 Àz\300 Áz\301 Âz\302 Ãz\303 Äz\304 Åz\305 Æz\306 Çz\307 Èz\310 Éz\311 Êz\312 Ëz\313 Ìz\314 Íz\315 Îz\316 Ïz\317 Ðz\320 Ñz\321 Òz\322 Óz\323 Ôz\324 Õz\325 Öz\326 ×z\327 Øz\330 Ùz\331 Úz\332 Ûz\333 Üz\334 Ýz\335 Þz\336 ßz\337 àz\340 áz\341 âz\342 ãz\343 äz\344 åz\345 æz\346 çz\347 èz\350 éz\351 êz\352 ëz\353 ìz\354 íz\355 îz\356 ïz\357 ðz\360 ñz\361 òz\362 óz\363z\364z\365z\366z\367z\370z\371z\372z\373z\374z\375z\376z\377) ô õ ö ÷ ø ù ú û ü ý þ ÿc | t fd| D r| S dt d | D z dz S )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.
c 3 K | ]}|v V d S Nr .0c
LegalCharss r z_quote..