urls.py 文件源码

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

项目:zanph 作者: zanph 项目源码 文件源码
def ascii_host(self):
        """Works exactly like :attr:`host` but will return a result that
        is restricted to ASCII.  If it finds a netloc that is not ASCII
        it will attempt to idna decode it.  This is useful for socket
        operations when the URL might include internationalized characters.
        """
        rv = self.host
        if rv is not None and isinstance(rv, text_type):
            try:
                rv = _encode_idna(rv)
            except UnicodeError:
                rv = rv.encode('ascii', 'ignore')
        return to_native(rv, 'ascii', 'ignore')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号