Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / html / python / lib / cookie-jar-objects.html
CommitLineData
920dae64
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="lib.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="lib.html" title='Python Library Reference' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="next" href="cookielib-examples.html" />
13<link rel="prev" href="default-cookie-policy-objects.html" />
14<link rel="parent" href="module-cookielib.html" />
15<link rel="next" href="cookielib-examples.html" />
16<meta name='aesop' content='information' />
17<title>11.20.5 Cookie Objects </title>
18</head>
19<body>
20<DIV CLASS="navigation">
21<div id='top-navigation-panel' xml:id='top-navigation-panel'>
22<table align="center" width="100%" cellpadding="0" cellspacing="2">
23<tr>
24<td class='online-navigation'><a rel="prev" title="11.20.4 DefaultCookiePolicy Objects"
25 href="default-cookie-policy-objects.html"><img src='../icons/previous.png'
26 border='0' height='32' alt='Previous Page' width='32' /></A></td>
27<td class='online-navigation'><a rel="parent" title="11.20 cookielib "
28 href="module-cookielib.html"><img src='../icons/up.png'
29 border='0' height='32' alt='Up One Level' width='32' /></A></td>
30<td class='online-navigation'><a rel="next" title="11.20.6 Examples"
31 href="cookielib-examples.html"><img src='../icons/next.png'
32 border='0' height='32' alt='Next Page' width='32' /></A></td>
33<td align="center" width="100%">Python Library Reference</td>
34<td class='online-navigation'><a rel="contents" title="Table of Contents"
35 href="contents.html"><img src='../icons/contents.png'
36 border='0' height='32' alt='Contents' width='32' /></A></td>
37<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
38 border='0' height='32' alt='Module Index' width='32' /></a></td>
39<td class='online-navigation'><a rel="index" title="Index"
40 href="genindex.html"><img src='../icons/index.png'
41 border='0' height='32' alt='Index' width='32' /></A></td>
42</tr></table>
43<div class='online-navigation'>
44<b class="navlabel">Previous:</b>
45<a class="sectref" rel="prev" href="default-cookie-policy-objects.html">11.20.4 DefaultCookiePolicy Objects</A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="module-cookielib.html">11.20 cookielib </A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="cookielib-examples.html">11.20.6 Examples</A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H2><A NAME="SECTION00132050000000000000000"></A><A NAME="cookie-jar-objects"></A>
56<BR>
5711.20.5 Cookie Objects
58</H2>
59
60<P>
61<tt class="class">Cookie</tt> instances have Python attributes roughly corresponding
62to the standard cookie-attributes specified in the various cookie
63standards. The correspondence is not one-to-one, because there are
64complicated rules for assigning default values, and because the
65<code>max-age</code> and <code>expires</code> cookie-attributes contain equivalent
66information.
67
68<P>
69Assignment to these attributes should not be necessary other than in
70rare circumstances in a <tt class="class">CookiePolicy</tt> method. The class does
71not enforce internal consistency, so you should know what you're
72doing if you do that.
73
74<P>
75<dl><dt><b><tt id='l2h-3660' xml:id='l2h-3660' class="member">version</tt></b></dt>
76<dd>
77Integer or <tt class="constant">None</tt>. Netscape cookies have version 0. RFC
782965 and RFC 2109 cookies have version 1.
79</dl>
80<dl><dt><b><tt id='l2h-3661' xml:id='l2h-3661' class="member">name</tt></b></dt>
81<dd>
82Cookie name (a string).
83</dl>
84<dl><dt><b><tt id='l2h-3662' xml:id='l2h-3662' class="member">value</tt></b></dt>
85<dd>
86Cookie value (a string), or <tt class="constant">None</tt>.
87</dl>
88<dl><dt><b><tt id='l2h-3663' xml:id='l2h-3663' class="member">port</tt></b></dt>
89<dd>
90String representing a port or a set of ports (eg. '80', or '80,8080'),
91or <tt class="constant">None</tt>.
92</dl>
93<dl><dt><b><tt id='l2h-3664' xml:id='l2h-3664' class="member">path</tt></b></dt>
94<dd>
95Cookie path (a string, eg. <code>'/acme/rocket_launchers'</code>).
96</dl>
97<dl><dt><b><tt id='l2h-3665' xml:id='l2h-3665' class="member">secure</tt></b></dt>
98<dd>
99True if cookie should only be returned over a secure connection.
100</dl>
101<dl><dt><b><tt id='l2h-3666' xml:id='l2h-3666' class="member">expires</tt></b></dt>
102<dd>
103Integer expiry date in seconds since epoch, or <tt class="constant">None</tt>. See
104also the <tt class="method">is_expired()</tt> method.
105</dl>
106<dl><dt><b><tt id='l2h-3667' xml:id='l2h-3667' class="member">discard</tt></b></dt>
107<dd>
108True if this is a session cookie.
109</dl>
110<dl><dt><b><tt id='l2h-3668' xml:id='l2h-3668' class="member">comment</tt></b></dt>
111<dd>
112String comment from the server explaining the function of this cookie,
113or <tt class="constant">None</tt>.
114</dl>
115<dl><dt><b><tt id='l2h-3669' xml:id='l2h-3669' class="member">comment_url</tt></b></dt>
116<dd>
117URL linking to a comment from the server explaining the function of
118this cookie, or <tt class="constant">None</tt>.
119</dl>
120
121<P>
122<dl><dt><b><tt id='l2h-3670' xml:id='l2h-3670' class="member">port_specified</tt></b></dt>
123<dd>
124True if a port or set of ports was explicitly specified by the server
125(in the <span class="mailheader">Set-Cookie:</span> / <span class="mailheader">Set-Cookie2:</span> header).
126</dl>
127<dl><dt><b><tt id='l2h-3671' xml:id='l2h-3671' class="member">domain_specified</tt></b></dt>
128<dd>
129True if a domain was explicitly specified by the server.
130</dl>
131<dl><dt><b><tt id='l2h-3672' xml:id='l2h-3672' class="member">domain_initial_dot</tt></b></dt>
132<dd>
133True if the domain explicitly specified by the server began with a
134dot (<code>'.'</code>).
135</dl>
136
137<P>
138Cookies may have additional non-standard cookie-attributes. These may
139be accessed using the following methods:
140
141<P>
142<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
143 <td><nobr><b><tt id='l2h-3673' xml:id='l2h-3673' class="method">has_nonstandard_attr</tt></b>(</nobr></td>
144 <td><var>name</var>)</td></tr></table></dt>
145<dd>
146Return true if cookie has the named cookie-attribute.
147</dl>
148<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
149 <td><nobr><b><tt id='l2h-3674' xml:id='l2h-3674' class="method">get_nonstandard_attr</tt></b>(</nobr></td>
150 <td><var>name, default=<tt class="constant">None</tt></var>)</td></tr></table></dt>
151<dd>
152If cookie has the named cookie-attribute, return its value.
153Otherwise, return <var>default</var>.
154</dl>
155<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
156 <td><nobr><b><tt id='l2h-3675' xml:id='l2h-3675' class="method">set_nonstandard_attr</tt></b>(</nobr></td>
157 <td><var>name, value</var>)</td></tr></table></dt>
158<dd>
159Set the value of the named cookie-attribute.
160</dl>
161
162<P>
163The <tt class="class">Cookie</tt> class also defines the following method:
164
165<P>
166<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
167 <td><nobr><b><tt id='l2h-3676' xml:id='l2h-3676' class="method">is_expired</tt></b>(</nobr></td>
168 <td><var></var><big>[</big><var>now=<tt class="constant">None</tt></var><big>]</big><var></var>)</td></tr></table></dt>
169<dd>
170True if cookie has passed the time at which the server requested it
171should expire. If <var>now</var> is given (in seconds since the epoch),
172return whether the cookie has expired at the specified time.
173</dl>
174
175<P>
176
177<DIV CLASS="navigation">
178<div class='online-navigation'>
179<p></p><hr />
180<table align="center" width="100%" cellpadding="0" cellspacing="2">
181<tr>
182<td class='online-navigation'><a rel="prev" title="11.20.4 DefaultCookiePolicy Objects"
183 href="default-cookie-policy-objects.html"><img src='../icons/previous.png'
184 border='0' height='32' alt='Previous Page' width='32' /></A></td>
185<td class='online-navigation'><a rel="parent" title="11.20 cookielib "
186 href="module-cookielib.html"><img src='../icons/up.png'
187 border='0' height='32' alt='Up One Level' width='32' /></A></td>
188<td class='online-navigation'><a rel="next" title="11.20.6 Examples"
189 href="cookielib-examples.html"><img src='../icons/next.png'
190 border='0' height='32' alt='Next Page' width='32' /></A></td>
191<td align="center" width="100%">Python Library Reference</td>
192<td class='online-navigation'><a rel="contents" title="Table of Contents"
193 href="contents.html"><img src='../icons/contents.png'
194 border='0' height='32' alt='Contents' width='32' /></A></td>
195<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
196 border='0' height='32' alt='Module Index' width='32' /></a></td>
197<td class='online-navigation'><a rel="index" title="Index"
198 href="genindex.html"><img src='../icons/index.png'
199 border='0' height='32' alt='Index' width='32' /></A></td>
200</tr></table>
201<div class='online-navigation'>
202<b class="navlabel">Previous:</b>
203<a class="sectref" rel="prev" href="default-cookie-policy-objects.html">11.20.4 DefaultCookiePolicy Objects</A>
204<b class="navlabel">Up:</b>
205<a class="sectref" rel="parent" href="module-cookielib.html">11.20 cookielib </A>
206<b class="navlabel">Next:</b>
207<a class="sectref" rel="next" href="cookielib-examples.html">11.20.6 Examples</A>
208</div>
209</div>
210<hr />
211<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
212</DIV>
213<!--End of Navigation Panel-->
214<ADDRESS>
215See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
216</ADDRESS>
217</BODY>
218</HTML>