您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

Google App Engine python入站邮件LookupError:未知编码

Google App Engine python入站邮件LookupError:未知编码

post调用入站邮件处理程序的方法时发生错误

  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/webapp/mail_handlers.py", line 70, in post
    self.receive(mail.InboundEmailMessage(self.request.body))

最简单的解决方案是post在您自己的处理程序中覆盖该方法以捕获错误

import logging
from google.appengine.ext.webapp.mail_handlers import InboundMailHandler


class MyInboundMailHandler(InboundMailHandler):

    def post(self):
        try:
            super(MyInboundMailHandler, self).post()
        except LookupError as ex:
            logging.warning('Could not process message because %s.', ex)

    def receive(self, mail_message):
        # Process message

如果不想丢失消息,可以创建并注册自定义iso-8859-8-i编解码器。

python 2022/1/1 18:47:33 有332人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶