def _handle_gmail_message(self, request_id, response, exception):
if exception is not None:
logging.error(str(exception))
else:
if response:
headers = response.get('payload').get('headers')
subject = _from = _to = _date = None
for h in headers:
if h.get('name') == 'Subject':
subject = h.get('value')
if h.get('name') == 'From':
_from = h.get('value')
if h.get('name') == 'To':
_to = h.get('value')
if h.get('name') == 'Date':
_date = h.get('value')
if subject and _from:
self.items.append(
Item(
svc=SERVICE.GMAIL,
title=subject,
subhead=_from,
id=response.get('id'),
type=SERVICE.EMAIL).json())
评论列表
文章目录