MCPcopy
hub / github.com/jhao104/proxy_pool / Proxy

Class Proxy

helper/proxy.py:18–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16
17
18class Proxy(object):
19
20 def __init__(self, proxy, fail_count=0, region="", anonymous="",
21 source="", check_count=0, last_status="", last_time="", https=False):
22 self._proxy = proxy
23 self._fail_count = fail_count
24 self._region = region
25 self._anonymous = anonymous
26 self._source = source.split('/')
27 self._check_count = check_count
28 self._last_status = last_status
29 self._last_time = last_time
30 self._https = https
31
32 @classmethod
33 def createFromJson(cls, proxy_json):
34 _dict = json.loads(proxy_json)
35 return cls(proxy=_dict.get("proxy", ""),
36 fail_count=_dict.get("fail_count", 0),
37 region=_dict.get("region", ""),
38 anonymous=_dict.get("anonymous", ""),
39 source=_dict.get("source", ""),
40 check_count=_dict.get("check_count", 0),
41 last_status=_dict.get("last_status", ""),
42 last_time=_dict.get("last_time", ""),
43 https=_dict.get("https", False)
44 )
45
46 @property
47 def proxy(self):
48 """ 代理 ip:port """
49 return self._proxy
50
51 @property
52 def fail_count(self):
53 """ 检测失败次数 """
54 return self._fail_count
55
56 @property
57 def region(self):
58 """ 地理位置(国家/城市) """
59 return self._region
60
61 @property
62 def anonymous(self):
63 """ 匿名 """
64 return self._anonymous
65
66 @property
67 def source(self):
68 """ 代理来源 """
69 return '/'.join(self._source)
70
71 @property
72 def check_count(self):
73 """ 代理检测次数 """
74 return self._check_count
75

Callers 3

testProxyClassFunction · 0.90
runMethod · 0.90
deleteFunction · 0.90

Calls

no outgoing calls

Tested by 1

testProxyClassFunction · 0.72