-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBotAPIs.py
More file actions
35 lines (30 loc) · 923 Bytes
/
BotAPIs.py
File metadata and controls
35 lines (30 loc) · 923 Bytes
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
import json
import requests
def requestXiaosi(spoken, appid='xiaosi', userid='user'):
url = 'https://api.ownthink.com/bot?spoken=' + spoken + '&appid=' + appid + '&userid=' + userid
try:
sess = requests.get(url)
answer = sess.text
answer = json.loads(answer)
return answer
except:
pass
def requestQingyun(msg, key='free',appid='0'):
url = 'http://api.qingyunke.com/api.php?key=' + key + '&appid=' + appid + '&msg=' + msg
try:
sess = requests.get(url)
answer = json.loads(sess.text)
return answer
except:
pass
def top_news():
url = 'http://api.avatardata.cn/TouTiao/Query?key=f1e821d4270a46ebabd038add0868915&type=top'
try:
res = requests.get(url)
res = json.loads(res.text)
return res
except:
pass
if __name__ == '__main__':
while True:
print(requestXiaosi(input()))