metadata.py 文件源码

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

项目:manubot 作者: greenelab 项目源码 文件源码
def get_pubmed_citeproc(pubmed_id):
    """
    Get the citeproc JSON for a PubMed or PubMed Central identifier

    https://github.com/ncbi/citation-exporter
    https://www.ncbi.nlm.nih.gov/pmc/tools/ctxp/
    https://www.ncbi.nlm.nih.gov/pmc/utils/ctxp/samples
    """
    params = {
        'ids': pubmed_id,
        'report': 'citeproc'
    }
    url = 'https://www.ncbi.nlm.nih.gov/pmc/utils/ctxp'
    response = requests.get(url, params)
    try:
        citeproc = response.json()
    except Exception as error:
        logging.error(f'Error fetching metadata for pmid:{pubmed_id}.\n'
                      f'Invalid response from {response.url}:\n{response.text}')
        raise error
    citeproc['URL'] = f'https://www.ncbi.nlm.nih.gov/pubmed/{pubmed_id}'
    return citeproc
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号