pybliometrics-dev / pybliometrics

Python-based API-Wrapper to access Scopus
https://pybliometrics.readthedocs.io/en/stable/
Other
410 stars 128 forks source link

How to solve a Scopus404Error in loop? #220

Closed tobiasvb7 closed 2 years ago

tobiasvb7 commented 2 years ago

Question?

Hi,

I have a dataset with papers including the DOI's.  I would like to retrieve the H-index from the first author.  The code below shows a loop that I made to retrieve all the H-indexes. However, the code works till a DOI is not in the scopus database. Then the error message Scopus404Error occurs. Is there a possibility to get around this problem? For example, that when a paper is not in the database a zero will return to the list and the loop will continue? I tried a lot of options, however all of the options seem not to work.

Looking forward to hearing from you.

Kind regards,

Tobias

def retrieve_h_index(doi):
    au = AbstractRetrieval(doi)
    au = AuthorRetrieval(au.authors[0].auid)
    h_index = au.h_index
    return h_index

df_doi = df['doi']
df_doi = df_doi[0:2]
doi = df_doi.tolist()
DOI = doi

for a in DOI:
    h_index = [retrieve_h_index(a) for a in DOI]

h_index
Michael-E-Rose commented 2 years ago

The part from the issue template, which you removed, is

"Please ask your question (e.g. "How do I do xyz?", "Can pybliometrics do abc"?) on StackOverflow.com and tag your question with pybliometrics."

Also, when you do that, be sure to have a minimum working example ready. Otherwise I cannot tell you what's wrong with your data (what's your DOI column, the author IDs, etc. )