Skip to content

Commit

Permalink
Update ScopusAbstract to reflect change in API
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-E-Rose committed Aug 9, 2017
1 parent e0624bc commit 640f98a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
7 changes: 7 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Change Log
----------

0.3.1
~~~~~

2017-08-09

* Update ScopusAbstract to reflect change in the API.

0.3.0
~~~~~

Expand Down
28 changes: 13 additions & 15 deletions scopus/scopus_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def subjectAreas(self):
@property
def authors(self):
"""A list of scopus_api._ScopusAuthor objects."""
if self._authors is not None:
if self._authors:
return self._authors
else:
raise TypeError("Could not load authors. "
Expand Down Expand Up @@ -213,20 +213,20 @@ def __init__(self, EID, view='META_ABS', refresh=False):
raise Exception('\n{0}\n{1}'.format(EID, self.xml))

# Parse coredata
coredata = xml.find('dtd:coredata', ns)
coredata = xml.find('coredata', ns)
self._url = get_encoded_text(coredata, 'prism:url')
self.identifier = get_encoded_text(coredata, 'dc:identifier')
self.eid = get_encoded_text(coredata, 'dtd:eid')
self.eid = get_encoded_text(coredata, 'eid')
self._doi = get_encoded_text(coredata, 'prism:doi')
self._title = get_encoded_text(coredata, 'dc:title')
self._aggregationType = get_encoded_text(coredata,
'prism:aggregationType')
self._publicationName = get_encoded_text(coredata,
'prism:publicationName')
self._srctype = get_encoded_text(coredata, 'dtd:srctype')
self._citedby_count = get_encoded_text(coredata, 'dtd:citedby-count')
self._srctype = get_encoded_text(coredata, 'srctype')
self._citedby_count = get_encoded_text(coredata, 'citedby-count')
self._publisher = get_encoded_text(coredata, 'dc:publisher')
self._source_id = get_encoded_text(coredata, 'dtd:source-id')
self._source_id = get_encoded_text(coredata, 'source-id')
self._issn = get_encoded_text(coredata, 'prism:issn')
self._volume = get_encoded_text(coredata, 'prism:volume')
self._issueIdentifier = get_encoded_text(coredata,
Expand All @@ -241,24 +241,22 @@ def __init__(self, EID, view='META_ABS', refresh=False):
self._abstract = get_encoded_text(coredata,
'dc:description/abstract/ce:para')

sl = coredata.find('dtd:link[@rel="scopus"]', ns).get('href')
self_link = coredata.find('dtd:link[@rel="self"]', ns).get('href')
cite_link = coredata.find('dtd:link[@rel="cited-by"]', ns)
self.scopus_link = coredata.find('link[@rel="scopus"]', ns).get('href')
self.self_link = coredata.find('link[@rel="self"]', ns).get('href')
cite_link = coredata.find('link[@rel="cited-by"]', ns)
if cite_link:
cite_link = cite_link.get('href')
self.scopus_link = sl
self.self_link = self_link
self.cite_link = cite_link

# Parse subject-areas
subjectAreas = xml.find('dtd:subject-areas', ns)
subjectAreas = xml.find('subject-areas', ns)
try:
self._subjectAreas = [a.text for a in subjectAreas]
except:
self._subjectAreas = None

# Parse authors
authors = xml.find('dtd:authors', ns)
authors = xml.find('authors', ns)
try:
self._authors = [_ScopusAuthor(author) for author in authors]
except TypeError:
Expand Down Expand Up @@ -593,9 +591,9 @@ def __init__(self, author):
self.surname = get_encoded_text(author, 'ce:surname')
self.initials = get_encoded_text(author, 'ce:initials')
self.author_url = get_encoded_text(author, 'dtd:author-url')
self.auid = author.attrib.get('auid', None)
self.auid = author.attrib.get('auid')
self.scopusid = self.auid
self.seq = author.attrib.get('seq', None)
self.seq = author.attrib.get('seq')
self.affiliations = [_ScopusAuthorAffiliation(aff)
for aff in author.findall('dtd:affiliation', ns)]

Expand Down

0 comments on commit 640f98a

Please sign in to comment.