-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCallApiInfo.py
More file actions
44 lines (35 loc) · 1.37 KB
/
CallApiInfo.py
File metadata and controls
44 lines (35 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import time
import requests
from urllib import parse
import xml.etree.ElementTree as ET
clientID = "Your ClientId"
accessToken = "Your AccessToken"
if __name__=='__main__':
cn="322433"
""" CallApiInfo의 실행을 위해 연구원상세보기 api를 호출합니다. """
url=("https://apigateway.kisti.re.kr/openapicall.do?" +
"client_id=" + clientID +
"&token=" + accessToken +
"&version=1.0" +
"&action=browse" +
"&target=RESEARCHER"+
"&cn=" + cn)
response=requests.get(url)
print(response.text)
"""
xml를 파싱후 CallAPIInfo의 API-001-01를 찾고 논문 검색 API를 호출합니다.
"""
xmlRoot=ET.fromstring(response.text)
callApiInfo=xmlRoot.findall('recordList/record/item[@metaCode="CallAPIInfo"]')
for i in callApiInfo:
if i.find('item[@metaCode="ProviderAPIId"]').text=="API-001-01":
query = parse.quote(i.find('item[@metaCode="ParameterValue"]').text)
target_URL = ("https://apigateway.kisti.re.kr/openapicall.do?" +
"client_id=" + clientID +
"&token=" + accessToken +
"&version=1.0" +
"&action=search" +
"&target=ARTI"+
"&searchQuery=" + query)
resonse = requests.get(target_URL)
print(resonse.text)