def __init__(self, cookie_location="cookie.txt"):
"""
Base constructor. Responsible for setting up the requests object and cookie jar.
All configuration values should be set prior to constructing an object of this
type; changes to configuration will not take effect on variables which already
exist.
"""
self.session = requests.Session()
self.session.cookies = cookielib.LWPCookieJar(cookie_location)
try:
self.session.cookies.load()
except IOError:
# Cookie file doesn't exist.
pass
self.session.headers.update(self.default_headers)
self.session.params.update(self.default_params)
评论列表
文章目录