Projekt

Obecné

Profil

Stáhnout (1.22 KB) Statistiky
| Větev: | Tag: | Revize:
1 bba28c53 silhavyj
from configparser import RawConfigParser
2
3
4
CONFIG_FILE = "config.ini"
5
6
usb_detector_section = "usb_detector"
7
server_section = "server"
8
logger_section = "logger"
9
cache_section = "cache"
10
11
config = RawConfigParser()
12
config.read(CONFIG_FILE)
13
14
scan_period_seconds = float(config[usb_detector_section]["scan_period_seconds"])
15
connected_devices_filename = config[usb_detector_section]["connected_devices_filename"]
16
17
server_url = config[server_section]["url"]
18
server_port = config[server_section]["port"]
19
server_endpoint = config[server_section]["end_point"]
20
21 0b96f10c Pultak
logger_config = config[logger_section]["file"]
22 bba28c53 silhavyj
logger_format = config[logger_section]["format"]
23
logger_level_str = config[logger_section]["level"]
24
logger_level = 0
25
26
if logger_level_str == "DEBUG":
27
    logger_level = 10
28
elif logger_level_str == "INFO":
29
    logger_level = 20
30
elif logger_level_str == "WARNING":
31
    logger_level = 30
32
elif logger_level_str == "ERROR":
33
    logger_level = 40
34
elif logger_level_str == "CRITICAL":
35
    logger_level = 50
36 76b68bb9 silhavyj
37
cache_dir = config[cache_section]["directory"]
38
cache_max_entries = int(config[cache_section]["max_entries"])
39
cache_max_retries = int(config[cache_section]["max_retries"])
40
cache_retry_period_seconds = float(config[cache_section]["retry_period_seconds"])