Skip to content

Instantly share code, notes, and snippets.

@Jonovono
Last active October 24, 2016 21:55
Show Gist options
  • Save Jonovono/a0f4c34d3e40a317898ec930936a0180 to your computer and use it in GitHub Desktop.
Save Jonovono/a0f4c34d3e40a317898ec930936a0180 to your computer and use it in GitHub Desktop.
Medline API
# you need to install Biopython:
# pip install biopython
# Full discussion:
# https://marcobonzanini.wordpress.com/2015/01/12/searching-pubmed-with-python/
from Bio import Entrez, Medline
IDS = ['20808220', '20396467', '17903820', '17903981']
if __name__ == '__main__':
Entrez.email = 'your.email@example.com'
ids_joined = ','.join(IDS)
handle = Entrez.efetch(db='pubmed',
retmode='text',
rettype='medline',
id=ids_joined)
records = Medline.parse(handle)
for record in records:
for key, value in record.iteritems():
print "%s - %s" % (key, value)
print
print '***********************'
print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment