diff options
Diffstat (limited to 's2.py')
| -rw-r--r-- | s2.py | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -115,6 +115,7 @@ class SemanticScholarAPI(object): AUTHOR_ENDPOINT = "{}/{}".format(BASE_URL, "author") PAPER_ENDPOINT = "{}/{}".format(BASE_URL, "paper") SEARCH_ENDPOINT = "https://www.semanticscholar.org/api/1/search" + RAW_PAPER_ENDPOINT = "https://www.semanticscholar.org/api/1/paper" @staticmethod def paper(paper_id, **kwargs): @@ -133,6 +134,12 @@ class SemanticScholarAPI(object): return "http://pdfs.semanticscholar.org/{}/{}.pdf".format(paper_id[:4], paper_id[4:]) @staticmethod + def raw_paper(paper_id, **kwargs): + url = "{}/{}".format(SemanticScholarAPI.RAW_PAPER_ENDPOINT, paper_id) + resp = requests.get(url, params=kwargs) + return None if resp.status_code != 200 else resp.json() # Paper(**resp.json()) + + @staticmethod def search(q): resp = requests.post(SemanticScholarAPI.SEARCH_ENDPOINT, json={ 'authors': [], |
