A python library that aims to retrieve data from Semantic Scholar API
Project description
semanticscholar
A python library that aims to retrieve data from Semantic Scholar API.
How to install
pip install semanticscholar
Usage
Programmatically access paper and author data. Can be used to access both the public API or the S2 Data Partner's API using a private key.
Paper Lookup (Public API)
To access paper data:
>>> from semanticscholar import SemanticScholar
>>> sch = SemanticScholar(timeout=2)
>>> paper = sch.paper('10.1093/mind/lix.236.433')
>>> paper.keys()
dict_keys(['abstract', 'arxivId', 'authors', 'citationVelocity', 'citations', 'doi',
'influentialCitationCount', 'paperId', 'references', 'title', 'topics', 'url', 'venue', 'year'])
>>> paper['title']
'Computing Machinery and Intelligence'
>>> for author in paper['authors']:
... print(author['name'])
... print(author['authorId'])
...
'Alan M. Turing'
2262347
Author Lookup (Public API)
To access author data:
>>> from semanticscholar import SemanticScholar
>>> sch = SemanticScholar(timeout=2)
>>> author = sch.author(2262347)
>>> author.keys()
dict_keys(['aliases', 'authorId', 'citationVelocity', 'influentialCitationCount', 'name', 'papers', 'url'])
>>> author['name']
'Alan M. Turing'
>>> len(author['papers'])
77
Accessing the Data Partner's API
If you are a Semantic Scholar Data Partner you can provide the private key as an optional argument:
>>> from semanticscholar import SemanticScholar
>>> s2_api_key = '40-CharacterPrivateKeyProvidedToPartners'
>>> sch = SemanticScholar(api_key=s2_api_key)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
semanticscholar-0.2.0.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for semanticscholar-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44722667498c5d2efae24d9dc3661fad7ea3ab79f90bdcd0f318f55b81913159 |
|
MD5 | 2fb7dccba851cfdf89b3000406b70fb7 |
|
BLAKE2b-256 | 309a474cec3a538e71a715563836f17989c7801e855bea62887eafd3ef2c6e4f |