axione-elig-test/axione_api/config.py
Félix Baylac-Jacqué 53af975601
Pep-8 reformat
I did not really used a standard python format so far. Running the
codebase through black to make everything pep-8 compliant.
2021-10-17 22:31:06 +02:00

20 lines
530 B
Python

import configparser
class Config:
def __init__(self, username, password, source_addr):
self.username = username
self.password = password
self.source_addr = source_addr
self.debug = False
def parse_config(cfgPath):
cfg = configparser.ConfigParser()
with open(cfgPath, "r") as f:
cfg.read_file(f)
username = cfg.get("API", "username")
passwd = cfg.get("API", "password")
source_addr = cfg.get("API", "source_addr")
return Config(username, passwd, source_addr)