def readAllDocsFromAuthor(self, authorID='7004367821'):
     ## Read all documents for example author, then write to disk
     my_auth = ElsAuthor(
         uri='https://api.elsevier.com/content/author/author_id/' +
         authorID)
     if my_auth.read_docs(self.client):
         print("my_auth.doc_list has " + str(len(my_auth.doc_list)) +
               " items.")
         my_auth.write_docs()
     else:
         print("Read docs for author failed.")
Exemplo n.º 2
0
else:
    print ("Read document failed.")


## Load list of documents from the API into affilation and author objects.
# Since a document list is retrieved for 25 entries at a time, this is
#  a potentially lenghty operation - hence the prompt.
print ("Load documents (Y/N)?")
s = input('--> ')

if (s == "y" or s == "Y"):

    ## Read all documents for example author, then write to disk
    if my_auth.read_docs(client):
        print ("my_auth.doc_list has " + str(len(my_auth.doc_list)) + " items.")
        my_auth.write_docs()
    else:
        print ("Read docs for author failed.")

    ## Read all documents for example affiliation, then write to disk
    if my_aff.read_docs(client):
        print ("my_aff.doc_list has " + str(len(my_aff.doc_list)) + " items.")
        my_aff.write_docs()
    else:
        print ("Read docs for affiliation failed.")

## Initialize author search object and execute search
auth_srch = ElsSearch('authlast(keuskamp)','author')
auth_srch.execute(client)
print ("auth_srch has", len(auth_srch.results), "results.")