forked from qiyeboy/IPProxyPool
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapiServer.py
More file actions
43 lines (33 loc) · 867 Bytes
/
Copy pathapiServer.py
File metadata and controls
43 lines (33 loc) · 867 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
36
37
38
39
40
41
42
43
# coding:utf-8
'''
定义几个关键字,count type,protocol,country,area,
'''
import json
import sys
import web
import config
from db.DataStore import sqlhelper
from db.SqlHelper import Proxy
urls = (
'/', 'select',
'/delete', 'delete'
)
def start_api_server():
sys.argv.append('0.0.0.0:%s' % config.API_PORT)
app = web.application(urls, globals())
app.run()
class select(object):
def GET(self):
inputs = web.input()
json_result = json.dumps(sqlhelper.select(inputs.get('count', None), inputs))
return json_result
class delete(object):
params = {}
def GET(self):
inputs = web.input()
json_result = json.dumps(sqlhelper.delete(inputs))
return json_result
if __name__ == '__main__':
sys.argv.append('0.0.0.0:8000')
app = web.application(urls, globals())
app.run()