base.py 文件源码

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

项目:zun 作者: openstack 项目源码 文件源码
def validate_link(self, link, bookmark=False):
        """Checks if the given link can get correct data."""
        # removes the scheme and net location parts of the link
        url_parts = list(urlparse.urlparse(link))
        url_parts[0] = url_parts[1] = ''

        # bookmark link should not have the version in the URL
        if bookmark and url_parts[2].startswith(PATH_PREFIX):
            return False

        full_path = urlparse.urlunparse(url_parts)
        try:
            self.get_json(full_path, path_prefix='')
            return True
        except Exception:
            return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号