Beispiel #1
0
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
Beispiel #2
0
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
Beispiel #3
0
pprint(response)

print """

-----------------------------------------------------
Delete library document
-----------------------------------------------------"""
response = mendeley.delete_library_document(documentId)
pprint(response)

print """

-----------------------------------------------------
Documents authored
-----------------------------------------------------"""
response = mendeley.documents_authored()
pprint(response)

print """

-----------------------------------------------------
Create new folder
-----------------------------------------------------"""
response = mendeley.create_folder(folder=json.dumps({'name': 'Test folder creation'}))
pprint(response)
folderId = response['folder_id']

print """

-----------------------------------------------------
List folders