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

Class ConfigHandler

handler/configHandler.py:22–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20
21
22class ConfigHandler(withMetaclass(Singleton)):
23
24 def __init__(self):
25 pass
26
27 @LazyProperty
28 def serverHost(self):
29 return os.environ.get("HOST", setting.HOST)
30
31 @LazyProperty
32 def serverPort(self):
33 return os.environ.get("PORT", setting.PORT)
34
35 @LazyProperty
36 def dbConn(self):
37 return os.getenv("DB_CONN", setting.DB_CONN)
38
39 @LazyProperty
40 def tableName(self):
41 return os.getenv("TABLE_NAME", setting.TABLE_NAME)
42
43 @property
44 def fetchers(self):
45 reload_six(setting)
46 return setting.PROXY_FETCHER
47
48 @LazyProperty
49 def httpUrl(self):
50 return os.getenv("HTTP_URL", setting.HTTP_URL)
51
52 @LazyProperty
53 def httpsUrl(self):
54 return os.getenv("HTTPS_URL", setting.HTTPS_URL)
55
56 @LazyProperty
57 def verifyTimeout(self):
58 return int(os.getenv("VERIFY_TIMEOUT", setting.VERIFY_TIMEOUT))
59
60 # @LazyProperty
61 # def proxyCheckCount(self):
62 # return int(os.getenv("PROXY_CHECK_COUNT", setting.PROXY_CHECK_COUNT))
63
64 @LazyProperty
65 def maxFailCount(self):
66 return int(os.getenv("MAX_FAIL_COUNT", setting.MAX_FAIL_COUNT))
67
68 # @LazyProperty
69 # def maxFailRate(self):
70 # return int(os.getenv("MAX_FAIL_RATE", setting.MAX_FAIL_RATE))
71
72 @LazyProperty
73 def poolSizeMin(self):
74 return int(os.getenv("POOL_SIZE_MIN", setting.POOL_SIZE_MIN))
75
76 @LazyProperty
77 def proxyRegion(self):
78 return bool(os.getenv("PROXY_REGION", setting.PROXY_REGION))
79

Callers 12

testConfigFunction · 0.90
testProxyFetcherFunction · 0.90
DoValidatorClass · 0.90
__init__Method · 0.90
validator.pyFile · 0.90
runSchedulerFunction · 0.90
__init__Method · 0.90
__init__Method · 0.90
__showConfigureFunction · 0.90
__checkDBConfigFunction · 0.90
proxyApi.pyFile · 0.90
__init__Method · 0.90

Calls 1

withMetaclassFunction · 0.90

Tested by 2

testConfigFunction · 0.72
testProxyFetcherFunction · 0.72