INNER CODE UNIT · Python
_save_config_section
infobyte/emploleaks · emploleaks.py:592
def _save_config_section(self, section, values):
"""Save a section of key-value pairs to the config file."""
config = configparser.RawConfigParser()
config.read(self.configfilepath)
if not config.has_section(section):
config.add_section(section)
for k, v in values.items():
config.set(section, k, v)
os.makedirs(CONFIG_DIR, exist_ok=True)
with open(self.configfilepath, 'w') as f:
config.write(f)
def _auto_connect_clickhouse(self):
"""Try to connect to ClickHouse using saved config. Fails silently."""
try:
self.leaks_conn = clickhouse_driver.Client(
host=self.ch_host,
port=int(self.ch_port),