第十八天 记录 python cookielib模块

[TOC]

1. cookielib模块

基本包含

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'''
CookieJar____
/
FileCookieJar
/ |
MozillaCookieJar | LWPCookieJar
| |
| ---MSIEBase |
| / | |
| / MSIEDBCookieJar BSDDBCookieJar
|/
MSIECookieJar
'''
__all__ = ['Cookie', 'CookieJar', 'CookiePolicy', 'DefaultCookiePolicy',
'FileCookieJar', 'LWPCookieJar', 'lwp_cookie_str', 'LoadError',
'MozillaCookieJar']

2. Cookie类

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"""HTTP Cookie.
This class represents both Netscape and RFC 2965 cookies.
This is deliberately a very simple class. It just holds attributes. It's
possible to construct Cookie instances that don't comply with the cookie
standards. CookieJar.make_cookies is the factory function for Cookie
objects -- it deals with cookie parsing, supplying defaults, and
normalising to the representation used in this class. CookiePolicy is
responsible for checking them to see whether they should be accepted from
and returned to the server.
Note that the port may be present in the headers, but unspecified ("Port"
rather than"Port=80", for example); if this is the case, port is None.
"""

2. CookieJar类

1
2
3
4
5
6
"""Collection of HTTP cookies.
You may not need to know about this class: try
urllib2.build_opener(HTTPCookieProcessor).open(url).
"""

3. FileCookieJar(CookieJar)类

1
2
3
4
5
"""
Cookies are NOT loaded from the named file until either the .load() or
.revert() method is called.
"""

Author @Snaker95