zhiyzuo / python-scopus

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

KeyError: 'search-results' #17

Closed amiref closed 5 years ago

amiref commented 5 years ago

When I try to run the example mentioned in the website for search function ( scopus.search("KEY(topic modeling)", count=30) ), I encounter the following error:

KeyError: 'search-results'

zhiyzuo commented 5 years ago

You need to run this using the internet where there's subscription service. Otherwise, set "view" argument to "STANDARD". See here for more details.

Example:

 scopus.search("KEY(topic modeling)", count=30, view='STANDARD')
LeoFuchs commented 5 years ago

Thanks for that response, it saved my day!

Ecanlilar commented 4 years ago

Hi @zhiyzuo,

I'm getting the same error when I try the solution provided....

Any advice?

from pyscopus import Scopus
key = "xxxxxxxxxx"
scopus = Scopus(key)
search_df = scopus.search("KEY(topic modeling)", count=30, view='STANDARD')
search_df

Error:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-40-6fdd0112e16a> in <module>
      5 
      6 #### General Serarch #########
----> 7 search_df = scopus.search("KEY(topic modeling)", count=30, view='STANDARD')
      8 search_df

~\AppData\Local\Continuum\anaconda2\envs\Python3.6Test\lib\site-packages\pyscopus\scopus.py in search(self, query, count, type_, view)
     54             raise ValueError("%s is not a valid input for the number of entries to return." %number)
     55 
---> 56         result_df, total_count = _search_scopus(self.apikey, query, type_, view=view)
     57 
     58         if total_count <= count:

~\AppData\Local\Continuum\anaconda2\envs\Python3.6Test\lib\site-packages\pyscopus\utils.py in _search_scopus(key, query, type_, view, index)
    386     js = r.json()
    387     #print(r.url)
--> 388     total_count = int(js['search-results']['opensearch:totalResults'])
    389     entries = js['search-results']['entry']
    390 

KeyError: 'search-results'
zhiyzuo commented 4 years ago

Are you using internet whose IP address can be recognized by Scopus (e.g., campus/work network connection, provided by your affiliation has subscribed to Scopus)

Ecanlilar commented 4 years ago

Hi @zhiyzuo,

No I am not able to do that. Is there anyway around that?

zhiyzuo commented 4 years ago

@Ecanlilar VPN

veania commented 3 years ago

GOD BLESS YOU I didn't understand what was causing the error from the message