Module _MozillaCookieJar :: Class MozillaCookieJar
[hide private]
[frames] | no frames]

_ClassType MozillaCookieJar

cookielib.CookieJar --+    
                      |    
cookielib.FileCookieJar --+
                          |
                         MozillaCookieJar

WARNING: you may want to backup your browser's cookies file if you use this class to save cookies. I *think* it works, but there have been bugs in the past!

This class differs from CookieJar only in the format it uses to save and load cookies to and from a file. This class uses the Mozilla/Netscape `cookies.txt' format. lynx uses this file format, too.

Don't expect cookies saved while the browser is running to be noticed by the browser (in fact, Mozilla on unix will overwrite your saved cookies if you change them on disk while it's running; on Windows, you probably can't save at all while the browser is running).

Note that the Mozilla/Netscape format will downgrade RFC2965 cookies to Netscape cookies on saving.

In particular, the cookie version and port number information is lost, together with information about whether or not Path, Port and Discard were specified by the Set-Cookie2 (or Set-Cookie) header, and whether or not the domain as set in the HTTP header started with a dot (yes, I'm aware some domains in Netscape files start with a dot and some don't -- trust me, you really don't want to know any more about this).

Note that though Mozilla and Netscape use the same format, they use slightly different headers. The class saves cookies using the Netscape header by default (Mozilla can cope with that).

Instance Methods [hide private]
 
_really_load(self, f, filename, ignore_discard, ignore_expires)
 
save(self, filename=None, ignore_discard=False, ignore_expires=False)
Save cookies to a file.

Inherited from cookielib.FileCookieJar: __init__, load, revert

Inherited from cookielib.CookieJar: __iter__, __len__, __repr__, __str__, add_cookie_header, clear, clear_expired_cookies, clear_session_cookies, extract_cookies, make_cookies, set_cookie, set_cookie_if_ok, set_policy

Class Variables [hide private]
  magic_re = '#( Netscape)? HTTP Cookie File'
  header = ' # Netscape HTTP Cookie File\n # http://www.ne...

Inherited from cookielib.CookieJar: domain_re, dots_re, non_word_re, quote_re, strict_domain_re

Method Details [hide private]

save(self, filename=None, ignore_discard=False, ignore_expires=False)

 

Save cookies to a file.

Overrides: cookielib.FileCookieJar.save
(inherited documentation)

Class Variable Details [hide private]

header

Value:
'''    # Netscape HTTP Cookie File
    # http://www.netscape.com/newsref/std/cookie_spec.html
    # This is a generated file!  Do not edit.

'''