pybliometrics-dev / pybliometrics

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

Scopus401Error: The requestor is not authorized to access the requested view or fields of the resource #321

Closed Josephts1 closed 5 months ago

Josephts1 commented 5 months ago

I use Google Colaboratory as a development environment. The purpose of this code is to extract the citations that an article has had, the articles are published in the Scopus database. I chose to use the pybliometrics and pandas libraries. I use the pandas library to create an excel file with all the citations and citation information. I am associated with Scopus through my university, that is why my API KEY is authorized to access the database, but when compiling the following code it gives me the error described in the title of this commit. I appreciate any guidance or help you can give me.

import pandas as pd
from pybliometrics.scopus import ScopusSearch, CitationOverview

search = ScopusSearch('Pertuz Said', refresh=True)
eid = search.results[0].eid  # ¿Cómo obtener eid desde Scopus web?

citas = CitationOverview(eid)
cited_by_data = []
for article in citas:
    cited_by_data.append({
        'title': article.title,
        'authors': ', '.join(article.authors),
        'year': article.coverDate,
        'publication_name': article.publicationName,
        'source_title': article.sourceTitle
    })
df_cited_by = pd.DataFrame(cited_by_data)
df_cited_by.to_excel('cited_by.xlsx', index=False)

`

This is the error.

image image
Michael-E-Rose commented 5 months ago

Hey! A couple of answers.

  1. Please ask questions on https://stackoverflow.com/ in future. There are other questions related to #pybliometrics
  2. https://pybliometrics.readthedocs.io/en/stable/classes/ScopusSearch.html states that the query parameter needs to be "A string of the query as used in the Advanced Search on scopus.com." So please check that whatever you put in ScopusSearch() works on the Scopus website. Because what you put there isn't a working query.
  3. I have no experience with pybliometrics on a Google Colab; pybliometrics stores a lot of files in cache, including API keys. I'd be surprised if this works