zhiyzuo / python-scopus

PyScopus
http://zhiyzuo.github.io/python-scopus/
MIT License
23 stars 29 forks source link

retrieve_citation return KeyError: 'abstract-citations-response' #26

Closed diegojacobs closed 2 years ago

diegojacobs commented 2 years ago

I'm getting the following error when trying to use the retrieve_citation method. I'm using python 3. I know my API key is still valid since other calls work. I'm basically using the code from the examples in the documentation.

KeyError                                  Traceback (most recent call last)
/tmp/ipykernel_194/189473782.py in <module>
----> 1 pub_citations_df = scopus.retrieve_citation(scopus_id_array=['84905286162', '0141607824'],
      2                                             year_range=[2010, 2014])
      3 pub_citations_df

~/.local/lib/python3.8/site-packages/pyscopus/scopus.py in retrieve_citation(self, scopus_id_array, year_range)
    209         js = r.json()
    210 
--> 211         return _parse_citation(js, year_range)
    212 
    213     def retrieve_full_text(self, full_text_link):

~/.local/lib/python3.8/site-packages/pyscopus/utils.py in _parse_citation(js_citation, year_range)
     95 
     96 def _parse_citation(js_citation, year_range):
---> 97     resp = js_citation['abstract-citations-response']
     98     cite_info_list = resp['citeInfoMatrix']['citeInfoMatrixXML']['citationMatrix']['citeInfo']
     99 

KeyError: 'abstract-citations-response'
zhiyzuo commented 2 years ago

image

image

See more: https://dev.elsevier.com/api_key_settings.html