invalidroutesreporter.py 文件源码

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

项目:invalidroutesreporter 作者: pierky 项目源码 文件源码
def _connect_smtp(self, force=False):
        if self.smtp_connection is not None and not force:
            return True

        try:
            logging.debug("Connecting to SMTP server {}:{}".format(
                self.host, self.port))
            smtp = smtplib.SMTP(self.host, self.port)
            if self.username and self.password:
                smtp.login(self.username, self.password)
            self.smtp_connection = smtp
        except Exception as e:
            logging.error("Error while connecting to SMTP server: "
                          "{}".format(str(e)),
                          exc_info=True)
            return False

        return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号