forked from jhao104/proxy_pool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConfigGetter.py
71 lines (55 loc) · 1.59 KB
/
ConfigGetter.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: ConfigGetter
Description : 读取配置
Author : JHao
date: 2019/2/15
-------------------------------------------------
Change Activity:
2019/2/15:
-------------------------------------------------
"""
__author__ = 'JHao'
from Util.utilClass import LazyProperty
from Config.setting import *
class ConfigGetter(object):
"""
get config
"""
def __init__(self):
pass
@LazyProperty
def db_type(self):
return DATABASES.get("default", {}).get("TYPE", "SSDB")
@LazyProperty
def db_name(self):
return DATABASES.get("default", {}).get("NAME", "proxy")
@LazyProperty
def db_host(self):
return DATABASES.get("default", {}).get("HOST", "127.0.0.1")
@LazyProperty
def db_port(self):
return DATABASES.get("default", {}).get("PORT", 8080)
@LazyProperty
def db_password(self):
return DATABASES.get("default", {}).get("PASSWORD", "")
@LazyProperty
def proxy_getter_functions(self):
return PROXY_GETTER
@LazyProperty
def host_ip(self):
return SERVER_API.get("HOST", "127.0.0.1")
@LazyProperty
def host_port(self):
return SERVER_API.get("PORT", 5010)
config = ConfigGetter()
if __name__ == '__main__':
print(config.db_type)
print(config.db_name)
print(config.db_host)
print(config.db_port)
print(config.proxy_getter_functions)
print(config.host_ip)
print(config.host_port)
print(config.db_password)