core.py 文件源码

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

项目:editolido 作者: flyingeek 项目源码 文件源码
def get_latest_version_infos(url, filename='data/.editolido.cfg.json'):
    infos = infos_from_giturl(url)
    jsonurl = raw_content_url(url, filename, branch_or_tag=infos['branch'])
    logger.info('downloading %s' % jsonurl)
    try:
        r = requests.get(jsonurl, verify=True, timeout=(3.1, 27))
        r.raise_for_status()
        data = r.json()
        r.close()
    except requests.HTTPError:
        # noinspection PyUnboundLocalVariable
        logger.error('status code %s' % r.status_code)
        raise
    except requests.Timeout:  # pragma no cover
        logger.error('download timeout... aborting update')
        raise
    except requests.ConnectionError:  # pragma no cover
        logger.error('download connection error... aborting update')
        raise
    except requests.TooManyRedirects:  # pragma no cover
        logger.error('too many redirects... aborting update')
        raise
    except requests.exceptions.RequestException:  # pragma no cover
        logger.error('download fail... aborting update')
        raise
    return data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号