Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / html / python / lib / cookie-jar-objects.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index' />
<link rel="first" href="lib.html" title='Python Library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="cookielib-examples.html" />
<link rel="prev" href="default-cookie-policy-objects.html" />
<link rel="parent" href="module-cookielib.html" />
<link rel="next" href="cookielib-examples.html" />
<meta name='aesop' content='information' />
<title>11.20.5 Cookie Objects </title>
</head>
<body>
<DIV CLASS="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="11.20.4 DefaultCookiePolicy Objects"
href="default-cookie-policy-objects.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="11.20 cookielib "
href="module-cookielib.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="11.20.6 Examples"
href="cookielib-examples.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="default-cookie-policy-objects.html">11.20.4 DefaultCookiePolicy Objects</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-cookielib.html">11.20 cookielib </A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="cookielib-examples.html">11.20.6 Examples</A>
</div>
<hr /></div>
</DIV>
<!--End of Navigation Panel-->
<H2><A NAME="SECTION00132050000000000000000"></A><A NAME="cookie-jar-objects"></A>
<BR>
11.20.5 Cookie Objects
</H2>
<P>
<tt class="class">Cookie</tt> instances have Python attributes roughly corresponding
to the standard cookie-attributes specified in the various cookie
standards. The correspondence is not one-to-one, because there are
complicated rules for assigning default values, and because the
<code>max-age</code> and <code>expires</code> cookie-attributes contain equivalent
information.
<P>
Assignment to these attributes should not be necessary other than in
rare circumstances in a <tt class="class">CookiePolicy</tt> method. The class does
not enforce internal consistency, so you should know what you're
doing if you do that.
<P>
<dl><dt><b><tt id='l2h-3660' xml:id='l2h-3660' class="member">version</tt></b></dt>
<dd>
Integer or <tt class="constant">None</tt>. Netscape cookies have version 0. RFC
2965 and RFC 2109 cookies have version 1.
</dl>
<dl><dt><b><tt id='l2h-3661' xml:id='l2h-3661' class="member">name</tt></b></dt>
<dd>
Cookie name (a string).
</dl>
<dl><dt><b><tt id='l2h-3662' xml:id='l2h-3662' class="member">value</tt></b></dt>
<dd>
Cookie value (a string), or <tt class="constant">None</tt>.
</dl>
<dl><dt><b><tt id='l2h-3663' xml:id='l2h-3663' class="member">port</tt></b></dt>
<dd>
String representing a port or a set of ports (eg. '80', or '80,8080'),
or <tt class="constant">None</tt>.
</dl>
<dl><dt><b><tt id='l2h-3664' xml:id='l2h-3664' class="member">path</tt></b></dt>
<dd>
Cookie path (a string, eg. <code>'/acme/rocket_launchers'</code>).
</dl>
<dl><dt><b><tt id='l2h-3665' xml:id='l2h-3665' class="member">secure</tt></b></dt>
<dd>
True if cookie should only be returned over a secure connection.
</dl>
<dl><dt><b><tt id='l2h-3666' xml:id='l2h-3666' class="member">expires</tt></b></dt>
<dd>
Integer expiry date in seconds since epoch, or <tt class="constant">None</tt>. See
also the <tt class="method">is_expired()</tt> method.
</dl>
<dl><dt><b><tt id='l2h-3667' xml:id='l2h-3667' class="member">discard</tt></b></dt>
<dd>
True if this is a session cookie.
</dl>
<dl><dt><b><tt id='l2h-3668' xml:id='l2h-3668' class="member">comment</tt></b></dt>
<dd>
String comment from the server explaining the function of this cookie,
or <tt class="constant">None</tt>.
</dl>
<dl><dt><b><tt id='l2h-3669' xml:id='l2h-3669' class="member">comment_url</tt></b></dt>
<dd>
URL linking to a comment from the server explaining the function of
this cookie, or <tt class="constant">None</tt>.
</dl>
<P>
<dl><dt><b><tt id='l2h-3670' xml:id='l2h-3670' class="member">port_specified</tt></b></dt>
<dd>
True if a port or set of ports was explicitly specified by the server
(in the <span class="mailheader">Set-Cookie:</span> / <span class="mailheader">Set-Cookie2:</span> header).
</dl>
<dl><dt><b><tt id='l2h-3671' xml:id='l2h-3671' class="member">domain_specified</tt></b></dt>
<dd>
True if a domain was explicitly specified by the server.
</dl>
<dl><dt><b><tt id='l2h-3672' xml:id='l2h-3672' class="member">domain_initial_dot</tt></b></dt>
<dd>
True if the domain explicitly specified by the server began with a
dot (<code>'.'</code>).
</dl>
<P>
Cookies may have additional non-standard cookie-attributes. These may
be accessed using the following methods:
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-3673' xml:id='l2h-3673' class="method">has_nonstandard_attr</tt></b>(</nobr></td>
<td><var>name</var>)</td></tr></table></dt>
<dd>
Return true if cookie has the named cookie-attribute.
</dl>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-3674' xml:id='l2h-3674' class="method">get_nonstandard_attr</tt></b>(</nobr></td>
<td><var>name, default=<tt class="constant">None</tt></var>)</td></tr></table></dt>
<dd>
If cookie has the named cookie-attribute, return its value.
Otherwise, return <var>default</var>.
</dl>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-3675' xml:id='l2h-3675' class="method">set_nonstandard_attr</tt></b>(</nobr></td>
<td><var>name, value</var>)</td></tr></table></dt>
<dd>
Set the value of the named cookie-attribute.
</dl>
<P>
The <tt class="class">Cookie</tt> class also defines the following method:
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-3676' xml:id='l2h-3676' class="method">is_expired</tt></b>(</nobr></td>
<td><var></var><big>[</big><var>now=<tt class="constant">None</tt></var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
True if cookie has passed the time at which the server requested it
should expire. If <var>now</var> is given (in seconds since the epoch),
return whether the cookie has expired at the specified time.
</dl>
<P>
<DIV CLASS="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="11.20.4 DefaultCookiePolicy Objects"
href="default-cookie-policy-objects.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="11.20 cookielib "
href="module-cookielib.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="11.20.6 Examples"
href="cookielib-examples.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="default-cookie-policy-objects.html">11.20.4 DefaultCookiePolicy Objects</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-cookielib.html">11.20 cookielib </A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="cookielib-examples.html">11.20.6 Examples</A>
</div>
</div>
<hr />
<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>