Cookie
index
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/Cookie.py
Module Docs

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..
 
   >>> import Cookie
 
Most of the time you start by creating a cookie.  Cookies come in
three flavors, each with slightly different encoding semantics, but
more on that later.
 
   >>> C = Cookie.SimpleCookie()
   >>> C = Cookie.SerialCookie()
   >>> C = Cookie.SmartCookie()
 
[Note: Long-time users of Cookie.py will remember using
Cookie.Cookie() to create a Cookie object.  Although deprecated, it
is still supported by the code.  See the Backward Compatibility notes
for more information.]
 
Once you've created your Cookie, you can add values just as if it were
a dictionary.
 
   >>> C = Cookie.SmartCookie()
   >>> 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 = Cookie.SmartCookie()
   >>> 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 = Cookie.SmartCookie()
   >>> 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 = Cookie.SmartCookie()
   >>> 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 = Cookie.SmartCookie()
   >>> 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 = Cookie.SmartCookie()
   >>> C["twix"] = "none for you"
   >>> C["twix"].value
   'none for you'
 
 
A Bit More Advanced
-------------------
 
As mentioned before, there are three different flavors of Cookie
objects, each with different encoding/decoding semantics.  This
section briefly discusses the differences.
 
SimpleCookie
 
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 = Cookie.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'
 
 
SerialCookie
 
The SerialCookie expects that all values should be serialized using
cPickle (or pickle, if cPickle isn't available).  As a result of
serializing, SerialCookie can save almost any Python object to a
value, and recover the exact same object when the cookie has been
returned.  (SerialCookie can yield some strange-looking cookie
values, however.)
 
   >>> C = Cookie.SerialCookie()
   >>> C["number"] = 7
   >>> C["string"] = "seven"
   >>> C["number"].value
   7
   >>> C["string"].value
   'seven'
   >>> C.output()
   'Set-Cookie: number="I7\\012."\r\nSet-Cookie: string="S\'seven\'\\012p1\\012."'
 
Be warned, however, if SerialCookie cannot de-serialize a value (because
it isn't a valid pickle'd object), IT WILL RAISE AN EXCEPTION.
 
 
SmartCookie
 
The SmartCookie combines aspects of each of the other two flavors.
When setting a value in a dictionary-fashion, the SmartCookie will
serialize (ala cPickle) the value *if and only if* it isn't a
Python string.  String objects are *not* serialized.  Similarly,
when the load() method parses out values, it attempts to de-serialize
the value.  If it fails, then it fallsback to treating the value
as a string.
 
   >>> C = Cookie.SmartCookie()
   >>> C["number"] = 7
   >>> C["string"] = "seven"
   >>> C["number"].value
   7
   >>> C["string"].value
   'seven'
   >>> C.output()
   'Set-Cookie: number="I7\\012."\r\nSet-Cookie: string=seven'
 
 
Backwards Compatibility
-----------------------
 
In order to keep compatibilty with earlier versions of Cookie.py,
it is still possible to use Cookie.Cookie() to create a Cookie.  In
fact, this simply returns a SmartCookie.
 
   >>> C = Cookie.Cookie()
   >>> print C.__class__.__name__
   SmartCookie
 
 
Finis.

 
Modules
       
re
string
warnings

 
Classes
       
__builtin__.dict(__builtin__.object)
BaseCookie
SerialCookie
SimpleCookie
SmartCookie
exceptions.Exception(exceptions.BaseException)
CookieError

 
class BaseCookie(__builtin__.dict)
    # At long last, here is the cookie class.
#   Using this class is almost just like using a dictionary.
# See this module's docstring for example usage.
 
 
Method resolution order:
BaseCookie
__builtin__.dict
__builtin__.object

Methods defined here:
__init__(self, input=None)
__repr__(self)
__setitem__(self, key, value)
Dictionary style assignment.
__str__ = output(self, attrs=None, header='Set-Cookie:', sep='\r\n')
js_output(self, attrs=None)
Return a string suitable for JavaScript.
load(self, rawdata)
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())
output(self, attrs=None, header='Set-Cookie:', sep='\r\n')
Return a string suitable for HTTP.
value_decode(self, val)
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.
value_encode(self, val)
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.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Methods inherited from __builtin__.dict:
__cmp__(...)
x.__cmp__(y) <==> cmp(x,y)
__contains__(...)
D.__contains__(k) -> True if D has a key k, else False
__delitem__(...)
x.__delitem__(y) <==> del x[y]
__eq__(...)
x.__eq__(y) <==> x==y
__ge__(...)
x.__ge__(y) <==> x>=y
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__gt__(...)
x.__gt__(y) <==> x>y
__iter__(...)
x.__iter__() <==> iter(x)
__le__(...)
x.__le__(y) <==> x<=y
__len__(...)
x.__len__() <==> len(x)
__lt__(...)
x.__lt__(y) <==> x<y
__ne__(...)
x.__ne__(y) <==> x!=y
__sizeof__(...)
D.__sizeof__() -> size of D in memory, in bytes
clear(...)
D.clear() -> None.  Remove all items from D.
copy(...)
D.copy() -> a shallow copy of D
fromkeys(...)
dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.
v defaults to None.
get(...)
D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.
has_key(...)
D.has_key(k) -> True if D has a key k, else False
items(...)
D.items() -> list of D's (key, value) pairs, as 2-tuples
iteritems(...)
D.iteritems() -> an iterator over the (key, value) items of D
iterkeys(...)
D.iterkeys() -> an iterator over the keys of D
itervalues(...)
D.itervalues() -> an iterator over the values of D
keys(...)
D.keys() -> list of D's keys
pop(...)
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised
popitem(...)
D.popitem() -> (k, v), remove and return some (key, value) pair as a
2-tuple; but raise KeyError if D is empty.
setdefault(...)
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
update(...)
D.update([E, ]**F) -> None.  Update D from dict/iterable E and F.
If E present and has a .keys() method, does:     for k in E: D[k] = E[k]
If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]
values(...)
D.values() -> list of D's values
viewitems(...)
D.viewitems() -> a set-like object providing a view on D's items
viewkeys(...)
D.viewkeys() -> a set-like object providing a view on D's keys
viewvalues(...)
D.viewvalues() -> an object providing a view on D's values

Data and other attributes inherited from __builtin__.dict:
__hash__ = None
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
Cookie = class SmartCookie(BaseCookie)
    SmartCookie
SmartCookie supports arbitrary objects as cookie values.  If the
object is a string, then it is quoted.  If the object is not a
string, however, then SmartCookie will use cPickle to serialize
the object into a string representation.
 
Note: Large cookie values add overhead because they must be
retransmitted on every HTTP transaction.
 
Note: HTTP has a 2k limit on the size of a cookie.  This class
does not check for this limit, so be careful!!!
 
 
Method resolution order:
SmartCookie
BaseCookie
__builtin__.dict
__builtin__.object

Methods defined here:
__init__(self, input=None)
value_decode(self, val)
# end __init__
value_encode(self, val)

Methods inherited from BaseCookie:
__repr__(self)
__setitem__(self, key, value)
Dictionary style assignment.
__str__ = output(self, attrs=None, header='Set-Cookie:', sep='\r\n')
Return a string suitable for HTTP.
js_output(self, attrs=None)
Return a string suitable for JavaScript.
load(self, rawdata)
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())
output(self, attrs=None, header='Set-Cookie:', sep='\r\n')
Return a string suitable for HTTP.

Data descriptors inherited from BaseCookie:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Methods inherited from __builtin__.dict:
__cmp__(...)
x.__cmp__(y) <==> cmp(x,y)
__contains__(...)
D.__contains__(k) -> True if D has a key k, else False
__delitem__(...)
x.__delitem__(y) <==> del x[y]
__eq__(...)
x.__eq__(y) <==> x==y
__ge__(...)
x.__ge__(y) <==> x>=y
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__gt__(...)
x.__gt__(y) <==> x>y
__iter__(...)
x.__iter__() <==> iter(x)
__le__(...)
x.__le__(y) <==> x<=y
__len__(...)
x.__len__() <==> len(x)
__lt__(...)
x.__lt__(y) <==> x<y
__ne__(...)
x.__ne__(y) <==> x!=y
__sizeof__(...)
D.__sizeof__() -> size of D in memory, in bytes
clear(...)
D.clear() -> None.  Remove all items from D.
copy(...)
D.copy() -> a shallow copy of D
fromkeys(...)
dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.
v defaults to None.
get(...)
D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.
has_key(...)
D.has_key(k) -> True if D has a key k, else False
items(...)
D.items() -> list of D's (key, value) pairs, as 2-tuples
iteritems(...)
D.iteritems() -> an iterator over the (key, value) items of D
iterkeys(...)
D.iterkeys() -> an iterator over the keys of D
itervalues(...)
D.itervalues() -> an iterator over the values of D
keys(...)
D.keys() -> list of D's keys
pop(...)
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised
popitem(...)
D.popitem() -> (k, v), remove and return some (key, value) pair as a
2-tuple; but raise KeyError if D is empty.
setdefault(...)
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
update(...)
D.update([E, ]**F) -> None.  Update D from dict/iterable E and F.
If E present and has a .keys() method, does:     for k in E: D[k] = E[k]
If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]
values(...)
D.values() -> list of D's values
viewitems(...)
D.viewitems() -> a set-like object providing a view on D's items
viewkeys(...)
D.viewkeys() -> a set-like object providing a view on D's keys
viewvalues(...)
D.viewvalues() -> an object providing a view on D's values

Data and other attributes inherited from __builtin__.dict:
__hash__ = None
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class CookieError(exceptions.Exception)
    # Define an exception visible to External modules
 
 
Method resolution order:
CookieError
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
class SerialCookie(BaseCookie)
    SerialCookie
SerialCookie supports arbitrary objects as cookie values. All
values are serialized (using cPickle) before being sent to the
client.  All incoming values are assumed to be valid Pickle
representations.  IF AN INCOMING VALUE IS NOT IN A VALID PICKLE
FORMAT, THEN AN EXCEPTION WILL BE RAISED.
 
Note: Large cookie values add overhead because they must be
retransmitted on every HTTP transaction.
 
Note: HTTP has a 2k limit on the size of a cookie.  This class
does not check for this limit, so be careful!!!
 
 
Method resolution order:
SerialCookie
BaseCookie
__builtin__.dict
__builtin__.object

Methods defined here:
__init__(self, input=None)
value_decode(self, val)
# end __init__
value_encode(self, val)

Methods inherited from BaseCookie:
__repr__(self)
__setitem__(self, key, value)
Dictionary style assignment.
__str__ = output(self, attrs=None, header='Set-Cookie:', sep='\r\n')
Return a string suitable for HTTP.
js_output(self, attrs=None)
Return a string suitable for JavaScript.
load(self, rawdata)
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())
output(self, attrs=None, header='Set-Cookie:', sep='\r\n')
Return a string suitable for HTTP.

Data descriptors inherited from BaseCookie:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Methods inherited from __builtin__.dict:
__cmp__(...)
x.__cmp__(y) <==> cmp(x,y)
__contains__(...)
D.__contains__(k) -> True if D has a key k, else False
__delitem__(...)
x.__delitem__(y) <==> del x[y]
__eq__(...)
x.__eq__(y) <==> x==y
__ge__(...)
x.__ge__(y) <==> x>=y
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__gt__(...)
x.__gt__(y) <==> x>y
__iter__(...)
x.__iter__() <==> iter(x)
__le__(...)
x.__le__(y) <==> x<=y
__len__(...)
x.__len__() <==> len(x)
__lt__(...)
x.__lt__(y) <==> x<y
__ne__(...)
x.__ne__(y) <==> x!=y
__sizeof__(...)
D.__sizeof__() -> size of D in memory, in bytes
clear(...)
D.clear() -> None.  Remove all items from D.
copy(...)
D.copy() -> a shallow copy of D
fromkeys(...)
dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.
v defaults to None.
get(...)
D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.
has_key(...)
D.has_key(k) -> True if D has a key k, else False
items(...)
D.items() -> list of D's (key, value) pairs, as 2-tuples
iteritems(...)
D.iteritems() -> an iterator over the (key, value) items of D
iterkeys(...)
D.iterkeys() -> an iterator over the keys of D
itervalues(...)
D.itervalues() -> an iterator over the values of D
keys(...)
D.keys() -> list of D's keys
pop(...)
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised
popitem(...)
D.popitem() -> (k, v), remove and return some (key, value) pair as a
2-tuple; but raise KeyError if D is empty.
setdefault(...)
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
update(...)
D.update([E, ]**F) -> None.  Update D from dict/iterable E and F.
If E present and has a .keys() method, does:     for k in E: D[k] = E[k]
If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]
values(...)
D.values() -> list of D's values
viewitems(...)
D.viewitems() -> a set-like object providing a view on D's items
viewkeys(...)
D.viewkeys() -> a set-like object providing a view on D's keys
viewvalues(...)
D.viewvalues() -> an object providing a view on D's values

Data and other attributes inherited from __builtin__.dict:
__hash__ = None
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class SimpleCookie(BaseCookie)
    SimpleCookie
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.
 
 
Method resolution order:
SimpleCookie
BaseCookie
__builtin__.dict
__builtin__.object

Methods defined here:
value_decode(self, val)
value_encode(self, val)

Methods inherited from BaseCookie:
__init__(self, input=None)
__repr__(self)
__setitem__(self, key, value)
Dictionary style assignment.
__str__ = output(self, attrs=None, header='Set-Cookie:', sep='\r\n')
Return a string suitable for HTTP.
js_output(self, attrs=None)
Return a string suitable for JavaScript.
load(self, rawdata)
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())
output(self, attrs=None, header='Set-Cookie:', sep='\r\n')
Return a string suitable for HTTP.

Data descriptors inherited from BaseCookie:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Methods inherited from __builtin__.dict:
__cmp__(...)
x.__cmp__(y) <==> cmp(x,y)
__contains__(...)
D.__contains__(k) -> True if D has a key k, else False
__delitem__(...)
x.__delitem__(y) <==> del x[y]
__eq__(...)
x.__eq__(y) <==> x==y
__ge__(...)
x.__ge__(y) <==> x>=y
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__gt__(...)
x.__gt__(y) <==> x>y
__iter__(...)
x.__iter__() <==> iter(x)
__le__(...)
x.__le__(y) <==> x<=y
__len__(...)
x.__len__() <==> len(x)
__lt__(...)
x.__lt__(y) <==> x<y
__ne__(...)
x.__ne__(y) <==> x!=y
__sizeof__(...)
D.__sizeof__() -> size of D in memory, in bytes
clear(...)
D.clear() -> None.  Remove all items from D.
copy(...)
D.copy() -> a shallow copy of D
fromkeys(...)
dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.
v defaults to None.
get(...)
D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.
has_key(...)
D.has_key(k) -> True if D has a key k, else False
items(...)
D.items() -> list of D's (key, value) pairs, as 2-tuples
iteritems(...)
D.iteritems() -> an iterator over the (key, value) items of D
iterkeys(...)
D.iterkeys() -> an iterator over the keys of D
itervalues(...)
D.itervalues() -> an iterator over the values of D
keys(...)
D.keys() -> list of D's keys
pop(...)
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised
popitem(...)
D.popitem() -> (k, v), remove and return some (key, value) pair as a
2-tuple; but raise KeyError if D is empty.
setdefault(...)
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
update(...)
D.update([E, ]**F) -> None.  Update D from dict/iterable E and F.
If E present and has a .keys() method, does:     for k in E: D[k] = E[k]
If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]
values(...)
D.values() -> list of D's values
viewitems(...)
D.viewitems() -> a set-like object providing a view on D's items
viewkeys(...)
D.viewkeys() -> a set-like object providing a view on D's keys
viewvalues(...)
D.viewvalues() -> an object providing a view on D's values

Data and other attributes inherited from __builtin__.dict:
__hash__ = None
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class SmartCookie(BaseCookie)
    SmartCookie
SmartCookie supports arbitrary objects as cookie values.  If the
object is a string, then it is quoted.  If the object is not a
string, however, then SmartCookie will use cPickle to serialize
the object into a string representation.
 
Note: Large cookie values add overhead because they must be
retransmitted on every HTTP transaction.
 
Note: HTTP has a 2k limit on the size of a cookie.  This class
does not check for this limit, so be careful!!!
 
 
Method resolution order:
SmartCookie
BaseCookie
__builtin__.dict
__builtin__.object

Methods defined here:
__init__(self, input=None)
value_decode(self, val)
# end __init__
value_encode(self, val)

Methods inherited from BaseCookie:
__repr__(self)
__setitem__(self, key, value)
Dictionary style assignment.
__str__ = output(self, attrs=None, header='Set-Cookie:', sep='\r\n')
Return a string suitable for HTTP.
js_output(self, attrs=None)
Return a string suitable for JavaScript.
load(self, rawdata)
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())
output(self, attrs=None, header='Set-Cookie:', sep='\r\n')
Return a string suitable for HTTP.

Data descriptors inherited from BaseCookie:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Methods inherited from __builtin__.dict:
__cmp__(...)
x.__cmp__(y) <==> cmp(x,y)
__contains__(...)
D.__contains__(k) -> True if D has a key k, else False
__delitem__(...)
x.__delitem__(y) <==> del x[y]
__eq__(...)
x.__eq__(y) <==> x==y
__ge__(...)
x.__ge__(y) <==> x>=y
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__gt__(...)
x.__gt__(y) <==> x>y
__iter__(...)
x.__iter__() <==> iter(x)
__le__(...)
x.__le__(y) <==> x<=y
__len__(...)
x.__len__() <==> len(x)
__lt__(...)
x.__lt__(y) <==> x<y
__ne__(...)
x.__ne__(y) <==> x!=y
__sizeof__(...)
D.__sizeof__() -> size of D in memory, in bytes
clear(...)
D.clear() -> None.  Remove all items from D.
copy(...)
D.copy() -> a shallow copy of D
fromkeys(...)
dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.
v defaults to None.
get(...)
D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.
has_key(...)
D.has_key(k) -> True if D has a key k, else False
items(...)
D.items() -> list of D's (key, value) pairs, as 2-tuples
iteritems(...)
D.iteritems() -> an iterator over the (key, value) items of D
iterkeys(...)
D.iterkeys() -> an iterator over the keys of D
itervalues(...)
D.itervalues() -> an iterator over the values of D
keys(...)
D.keys() -> list of D's keys
pop(...)
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised
popitem(...)
D.popitem() -> (k, v), remove and return some (key, value) pair as a
2-tuple; but raise KeyError if D is empty.
setdefault(...)
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
update(...)
D.update([E, ]**F) -> None.  Update D from dict/iterable E and F.
If E present and has a .keys() method, does:     for k in E: D[k] = E[k]
If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]
values(...)
D.values() -> list of D's values
viewitems(...)
D.viewitems() -> a set-like object providing a view on D's items
viewkeys(...)
D.viewkeys() -> a set-like object providing a view on D's keys
viewvalues(...)
D.viewvalues() -> an object providing a view on D's values

Data and other attributes inherited from __builtin__.dict:
__hash__ = None
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
Data
        __all__ = ['CookieError', 'BaseCookie', 'SimpleCookie', 'SerialCookie', 'SmartCookie', 'Cookie']