-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconnector.py
More file actions
28 lines (19 loc) · 1.04 KB
/
connector.py
File metadata and controls
28 lines (19 loc) · 1.04 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
import PySQLPool
class Connector:
__db = PySQLPool.getNewConnection(host="127.0.0.1",port=3306,user="tajnyuser",password="tajnehaslo",db="proxy")
__query = PySQLPool.getNewQuery(__db)
def get_proxy(self,id):
self.__query.Query("select host,port,timeout from proxy_list where id='%s'" % id)
return self.__query.record
def get_proxies_to_work(self):
self.__query.Query("select * from proxy_list where status = 0")
return self.__query.record
def get_all_proxies(self):
self.__query.Query("select * from proxy_list")
return self.__query.record
def update_timeout(self,id,timeout):
self.__query.Query("update proxy_list set timeout='%s' where id=%s", (timeout,id))
def update_status(self,id,status):
self.__query.Query("update proxy_list set status='%s' where id=%s", (status,id))
def add_proxy(self,host,port):
self.__query.Query("insert into proxy_list (host,port) values ('%s','%s')", (host,port))