Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
aff_id : str or int
The Scopus Affiliation ID. Optionally expressed
as an Elsevier EID (i.e., in the form 10-s2.0-nnnnnnnn).
refresh : bool (optional, default=False)
Whether to refresh the cached file if it exists or not.
Notes
-----
The files are cached in ~/.scopus/affiliation_retrieval/STANDARD/{aff_id}.
"""
view = "STANDARD" # In case Scopus adds different views in future
# Load json
aff_id = str(int(str(aff_id).split('-')[-1]))
Retrieval.__init__(self, identifier=aff_id, view=view, refresh=refresh,
api='ContentAffiliationRetrieval')
self._json = self._json['affiliation-retrieval-response']
author_id : str or int
The ID of the author to search for. Optionally expressed
as an Elsevier EID (i.e., in the form 9-s2.0-nnnnnnnn).
refresh : bool (optional, default=False)
Whether to refresh the cached file (if it exists) or not.
Notes
-----
The files are cached in ~/.scopus/author_retrieval/ENHANCED/{author_id}
(without eventually leading '9-s2.0-').
"""
# Load json
view = "ENHANCED" # In case Scopus adds different views in future
self._id = str(int(str(author_id).split('-')[-1]))
Retrieval.__init__(self, identifier=self._id, api='AuthorRetrieval',
refresh=refresh, view=view)
self._json = self._json['author-retrieval-response']
# Checks
try:
self._json = self._json[0]
except KeyError: # Incomplete forward
alias_json = listify(self._json['alias']['prism:url'])
alias = ', '.join([d['$'].split(':')[-1] for d in alias_json])
text = 'Author profile with ID {} has been merged and the main '\
'profile is now one of {}. Please update your records '\
'manually. Functionality of this object is '\
'reduced.'.format(author_id, alias)
warn(text, UserWarning)
"""
# Checks
identifier = str(identifier)
allowed_views = ('META', 'META_ABS', 'REF', 'FULL')
if view not in allowed_views:
raise ValueError('view parameter must be one of ' +
', '.join(allowed_views))
if id_type is None:
id_type = detect_id_type(identifier)
else:
allowed_id_types = ('eid', 'pii', 'scopus_id', 'pubmed_id', 'doi')
if id_type not in allowed_id_types:
raise ValueError('id_type parameter must be one of ' +
', '.join(allowed_id_types))
# Load json
Retrieval.__init__(self, identifier=identifier, id_type=id_type,
api='AbstractRetrieval', refresh=refresh, view=view)
self._json = self._json['abstracts-retrieval-response']
self._head = chained_get(self._json, ["item", "bibrecord", "head"], {})
path = ['source', 'additional-srcinfo', 'conferenceinfo', 'confevent']
self._confevent = chained_get(self._head, path, {})
The view of the file that should be downloaded. Allowed values:
BASIC, STANDARD, ENHANCED. For details see
https://dev.elsevier.com/guides/SerialTitleViews.htm.
Notes
-----
The files are cached in ~/.scopus/serial_title/{view}/{source_id}.
"""
# Checks
allowed_views = ('BASIC', 'STANDARD', 'ENHANCED')
if view not in allowed_views:
raise ValueError('view parameter must be one of ' +
', '.join(allowed_views))
# Load json
self._id = str(issn)
Retrieval.__init__(self, identifier=self._id, view=view,
api='SerialTitle', refresh=refresh)
self._json = self._json['serial-metadata-response']
self._entry = self._json['entry'][0]
refresh : bool (optional, default=False)
Whether to refresh the cached file if it exists or not.
Notes
-----
The files are cached in ~/.scopus/citation_overview/STANDARD/{eid}.
Your API Key needs to be approved by Elsevier to access this API.
"""
# Variables
self._start = int(start)
self._end = int(end)
view = "STANDARD" # In case Scopus adds different views in future
# Get file content
date = '{}-{}'.format(start, end)
Retrieval.__init__(self, eid, 'CitationOverview', refresh, view=view,
date=date)
self._data = self._json['abstract-citations-response']
# citeInfoMatrix
m = self._data['citeInfoMatrix']['citeInfoMatrixXML']['citationMatrix']['citeInfo'][0]
self._citeInfoMatrix = _parse_dict(m)
# identifier-legend
l = self._data['identifier-legend']['identifier'][0]
self._identifierlegend = _parse_dict(l)
# citeColumnTotalXML
self._citeColumnTotalXML = self._data['citeColumnTotalXML'] # not used