doi-doai-openaccess.py 文件源码

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

项目:bots 作者: nemobis 项目源码 文件源码
def get_doai_oa(doi):
    """ Given a DOI, return DOAI target URL if green open access,
        None otherwise.
    """

    doaiurl = 'http://doai.io/{}'.format(doi)
    try:
        doai = SESSIONDOAI.head(url=doaiurl)
    except requests.ConnectionError:
        time.sleep(random.randint(1, 100))
        return False

    if doai.status_code == 302:
        url = doai.headers['Location']
        if re.search('doi.org', url):
            return None
        else:
            return url
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号