services.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:cloud-memory 作者: onejgordon 项目源码 文件源码
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())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号