Skip to content

Commit

Permalink
bug for affiliation
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiyzuo committed Feb 6, 2018
1 parent 8dc998b commit aeb2f99
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
7 changes: 0 additions & 7 deletions pyscopus/scopus.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,7 @@
_parse_abstract_retrieval, trunc,\
_search_scopus

'''
03/03/2017:
Rewriting the whole class by request package
Use pandas.DataFrame and numpy.ndAarray all the time.
'''

class Scopus(object):

'''
Scopus class.
For instantiation of scopus objects to retrieve data from scopus.com
Expand Down
21 changes: 13 additions & 8 deletions pyscopus/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,24 @@ def _parse_affiliation_history(js_affiliation_history):
return affiliation_history_df

def _parse_author(entry):
#print(entry)
author_id = entry['dc:identifier'].split(':')[-1]
lastname = entry['preferred-name']['surname']
firstname = entry['preferred-name']['given-name']
doc_count = int(entry['document-count'])
# affiliations
affil = entry['affiliation-current']
try:
institution_name = affil['affiliation-name']
except:
if 'affiliation-current' in entry:
affil = entry['affiliation-current']
try:
institution_name = affil['affiliation-name']
except:
institution_name = None
try:
institution_id = affil['affiliation-id']
except:
institution_id = None
else:
institution_name = None
try:
institution_id = affil['affiliation-id']
except:
institution_id = None
#city = affil.find('affiliation-city').text
#country = affil.find('affiliation-country').text
Expand Down Expand Up @@ -285,7 +290,7 @@ def _search_scopus(key, query, type_, view, index=0):
pandas DataFrame
'''

par = {'apikey': key, 'query': query, 'start': index,
par = {'apikey': key, 'query': query, 'start': index,
'httpAccept': 'application/json', 'view': view}
if type_ == 'article' or type_ == 1:
r = requests.get(APIURI.SEARCH, params=par)
Expand Down

0 comments on commit aeb2f99

Please sign in to comment.