Skip to content

Instantly share code, notes, and snippets.

@astrofrog
Created November 23, 2010 22:39
Show Gist options
  • Select an option

  • Save astrofrog/712676 to your computer and use it in GitHub Desktop.

Select an option

Save astrofrog/712676 to your computer and use it in GitHub Desktop.
from mendeley_client import MendeleyClient
mendeley = MendeleyClient(..., ...) # Fill out API keys here
try:
mendeley.load_keys()
except IOError:
mendeley.get_required_keys()
mendeley.save_keys()
response = mendeley.library()
pages = response['items_per_page']
dois = {}
for page in range(pages):
print "Page %i..." % page
response = mendeley.library(page=page)
for document_id in response['document_ids']:
print "Document %s..." % document_id
document = mendeley.document_details(document_id)
if type(document['identifiers']) is dict \
and 'doi' in document['identifiers']:
dois[document_id] = document['identifiers']
else:
dois[document_id] = None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment