forked from jhao104/proxy_pool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestSsdbClient.py
43 lines (30 loc) · 1.14 KB
/
testSsdbClient.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
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: testSsdbClient
Description :
Author : JHao
date: 2020/7/3
-------------------------------------------------
Change Activity:
2020/7/3:
-------------------------------------------------
"""
__author__ = 'JHao'
def testSsdbClient():
from db.dbClient import DbClient
from helper.proxy import Proxy
uri = "ssdb://@127.0.0.1:8888"
db = DbClient(uri)
db.changeTable("use_proxy")
proxy = Proxy.createFromJson('{"proxy": "118.190.79.36:8090", "https": false, "fail_count": 0, "region": "", "anonymous": "", "source": "freeProxy14", "check_count": 4, "last_status": true, "last_time": "2021-05-26 10:58:04"}')
print("put: ", db.put(proxy))
print("get: ", db.get(https=None))
print("exists: ", db.exists("27.38.96.101:9797"))
print("exists: ", db.exists("27.38.96.101:8888"))
print("getAll: ", db.getAll(https=None))
# print("pop: ", db.pop(https=None))
print("clear: ", db.clear())
print("getCount", db.getCount())
if __name__ == '__main__':
testSsdbClient()