semanticscholar api used
This commit is contained in:
parent
4d84586a9d
commit
85a4106e18
@ -2,11 +2,11 @@ import json
|
||||
import requests
|
||||
from markdownify import markdownify as md
|
||||
|
||||
import config
|
||||
from config import __CONFIG__
|
||||
|
||||
key = config.__CONFIG__["fastgpt_api"]
|
||||
url = config.__CONFIG__["fastgpt_host"]
|
||||
setId = config.__CONFIG__["fastgpt_setId"]
|
||||
key = __CONFIG__["fastgpt_api"]
|
||||
url = __CONFIG__["fastgpt_host"]
|
||||
setId = __CONFIG__["fastgpt_setId"]
|
||||
|
||||
# Config FastGPT
|
||||
|
||||
|
24
semanticscholar.py
Normal file
24
semanticscholar.py
Normal file
@ -0,0 +1,24 @@
|
||||
import requests
|
||||
import json
|
||||
|
||||
from config import __CONFIG__
|
||||
|
||||
def latest_release():
|
||||
r2 = requests.get('https://api.semanticscholar.org/datasets/v1/release/latest').json()
|
||||
return r2['release_id']
|
||||
|
||||
def first_pull():
|
||||
res = requests.get('https://api.semanticscholar.org/datasets/v1/release/latest/dataset/abstract')
|
||||
return res.json()
|
||||
|
||||
def abstract():
|
||||
r3 = requests.get(headers={'x-api-key':__CONFIG__['semAPI']},url=
|
||||
'https://api.semanticscholar.org/datasets/v1/release/latest/dataset/abstracts').json()
|
||||
|
||||
def search_paper(question):
|
||||
query=""
|
||||
for i in question:
|
||||
query += "+" + i
|
||||
res = requests.get(headers={'x-api-key':__CONFIG__['semAPI']},
|
||||
url= 'https://api.semanticscholar.org/graph/v1/paper/search?fields=title,abstract&query='+query[+1:]).json()
|
||||
return res['data']
|
Loading…
Reference in New Issue
Block a user