def __init__(self, key=None, code=None, user_agent='', cache=None):
"""
This class is the base for access the XML API. Attributes
can be called on it to build a path to an endpoint.
Args:
key (str) - optional authentication keyID
code (str) - optional authentication vCode
user_agent (str) - optional (recommended) User-Agent
to use when making web requests
cache (preston.xmlapi.cache.Cache) - page cache
Returns:
None
"""
self.cache = cache or Cache()
self.user_agent = user_agent or 'Preston (github.com/Celeo/Preston)'
self.session = requests.session()
self.session.headers.update({'User-Agent': self.user_agent})
self.key = key
self.code = code
评论列表
文章目录