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
评论列表
文章目录