forked from wiggin15/BankMonitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
34 lines (21 loc) · 807 Bytes
/
config.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
#!/usr/bin/python
# -*- coding: utf-8 -*-
try:
from ConfigParser import ConfigParser
except ImportError: # Python 3.x
from configparser import ConfigParser
CONFIG_FILE_PATH = "config.ini"
_config = ConfigParser()
_config.read(CONFIG_FILE_PATH)
def get_config_value(section, option):
return _config.get(section, option)
def get_config_int(section, option):
return _config.getint(section, option)
def get_config_options(section):
return dict(_config.items(section))
def get_asset_sections():
all_sections = _config.sections()
return [x for x in all_sections if x not in {"general", "webserver"}]
WEBSERVER_IP_ADDR = get_config_value("webserver", "ip")
WEBSERVER_PORT = get_config_int("webserver", "port")
CSV_FILE_PATH = get_config_value("general", "data_file_path")