def auth_mendeley(self): from mendeley_client import MendeleyClient mendeley = MendeleyClient(XXXXXXX, XXXXXXX) #get from dev.mendeley.com try: mendeley.load_keys() except IOError: mendeley.get_required_keys() mendeley.save_keys() return mendeley
def get_mendeley_authored_documents(): '''This function gets all of the authored documents in the authorized library. It will return a dictionary named documents with keys documentId and several fields from the Mendeley API. ''' mendeley = MendeleyClient(settings.MENDELEY_CONSUMER_KEY, settings.MENDELEY_SECRET_KEY) try: mendeley.load_keys() except IOError: mendeley.get_required_keys() mendeley.save_keys() authored_document_list = {} response = mendeley.documents_authored() #this get a list of all documents authored by the authorized user for document in response['document_ids']: #this generates a list of all the details for each of these documents details = mendeley.document_details(document) authored_document_list[document] = details return authored_document_list
def get_mendeley_authored_documents(): '''This function gets all of the authored documents in the authorized library. It will return a dictionary named documents with keys documentId and several fields from the Mendeley API. ''' mendeley = MendeleyClient(settings.MENDELEY_CONSUMER_KEY, settings.MENDELEY_SECRET_KEY) try: mendeley.load_keys() except IOError: mendeley.get_required_keys() mendeley.save_keys() authored_document_list = {} response = mendeley.documents_authored( ) #this get a list of all documents authored by the authorized user for document in response[ 'document_ids']: #this generates a list of all the details for each of these documents details = mendeley.document_details(document) authored_document_list[document] = details return authored_document_list
from pprint import pprint from mendeley_client import MendeleyClient import json import os import sys import string import httplib #mendeley = MendeleyClient('<insert_consumer_key_here>', '<insert_secret_key_here>') mendeley = MendeleyClient('9a65b12d6eae277d5212a1205f57d5cc04fcc5392', 'e9b021c12e732c279c6f48a5cbcb99e5') try: mendeley.load_keys() except IOError: mendeley.get_required_keys() mendeley.save_keys() docId = raw_input('Insert document id: ') fileHash = raw_input('Insert file hash: ') ## If you want to download a group document, then introduce the group id and then call download_file_group instead #groupId = raw_input('Insert group id: ') response = mendeley.download_file(docId, fileHash) #if response.has_key('error'): # sys.exit(response['error']) # #if response.has_key('data'): # data = response['data'] #
""" from pprint import pprint from mendeley_client import MendeleyClient import json # import os import string # import sys mendeley = MendeleyClient('13a47f20711f5d5ffe8e8f4db1df1daa04f8bd9b6', '394d64a2907f23c7f6ea5d94fb386865') try: mendeley.load_keys() except IOError: mendeley.get_required_keys() mendeley.save_keys() class MPub(object): def __init__(self, uuid, title, abstract, authors, keywords, publication, tags, url, year): self.uuid = uuid self.title = title self.abstract = abstract self.authors = authors self.keywords = keywords self.title = title self.tags = tags self.url = url self.year = year