def __init__(self, config=None, proxy_config=None):
self.config = config
self.client = None
if proxy_config and 'host' in proxy_config and 'port' in proxy_config:
proxy_info = ProxyInfo(socks.PROXY_TYPE_HTTP_NO_TUNNEL,
proxy_config['host'], proxy_config['port'])
else:
proxy_info = None
self.http = Http(proxy_info=proxy_info)
self.var_dir = self.config['var_dir']
if not exists(self.var_dir):
makedirs(self.var_dir)
self.history_id_f = join(self.var_dir, 'gmail_last_history_id')
if exists(self.history_id_f):
with open(self.history_id_f) as fh:
logger.info('Loaded last gmail history id %d', int(fh.read()))
else:
# store an invalid id, which will get renewed on next push event
self.save_last_history_id('1')
评论列表
文章目录