address.py 文件源码

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

项目:isthislegit 作者: duo-labs 项目源码 文件源码
def ace_address(self):
        if not is_pure_ascii(self.mailbox):
            raise ValueError('address {} has no ASCII-compatable encoding'
                             .format(self.address.encode('utf-8')))
        ace_hostname = self.hostname
        if not is_pure_ascii(self.hostname):
            try:
                ace_hostname = idna.encode(self.hostname)
            except idna.IDNAError:
                raise ValueError('address {} has no ASCII-compatable encoding'
                                 .format(self.address.encode('utf-8')))
        return '{}@{}'.format(self.mailbox, ace_hostname)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号