-
Notifications
You must be signed in to change notification settings - Fork 1
/
python_api.py
54 lines (49 loc) · 1.82 KB
/
python_api.py
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
45
46
47
48
49
50
51
52
53
54
import tornado.ioloop
import tornado.web
import sqlite3
class Who(tornado.web.RequestHandler):
def get(self):
"""get请求"""
ids = self.get_argument('id')
hash = self.get_argument('hash')
if hash == "7DFxxxxxxxxxxxxxxxxxxxx":
con = sqlite3.connect('steemdatabase.db')
cur = con.cursor()
whois = 'select * from daili where name like "%s"' % ids
cur.execute(whois)
deleall = cur.fetchall()
con.commit()
data = []
for i in deleall:
d = {"name": i[0], "towho": i[1], "sp": i[2], "vesting": i[3], "time": i[4]}
data.append(d)
deleall = {"data": data}
con.commit()
else:
deleall = {"data": "hash_error"}
self.write(deleall)
class Towho(tornado.web.RequestHandler):
def get(self):
"""get请求"""
ids = self.get_argument('id')
hash = self.get_argument('hash')
if hash == "7DFC55A884A937A8AB81CD1EBAB3385E":
con = sqlite3.connect('steemdatabase.db')
cur = con.cursor()
whois = 'select * from daili where towho like "%s"' % ids
cur.execute(whois)
deleall = cur.fetchall()
con.commit()
data = []
for i in deleall:
d = {"name": i[0], "towho": i[1], "sp": i[2], "vesting": i[3], "time": i[4]}
data.append(d)
deleall = {"data": data}
con.commit()
else:
deleall = {"data": "hash_error"}
self.write(deleall)
application = tornado.web.Application([(r"/who", Who),(r"/towho", Towho) ])
if __name__ == "__main__":
application.listen(666)
tornado.ioloop.IOLoop.instance().start()