23 lines
975 B
Python
23 lines
975 B
Python
import configparser
|
|
|
|
|
|
class Config:
|
|
def __init__(self, username, password, source_addr, db_insee_communes_sqlite_path, db_fantoir_voies_sqlite_path):
|
|
self.username = username
|
|
self.password = password
|
|
self.source_addr = source_addr
|
|
self.db_insee_communes_sqlite_path = db_insee_communes_sqlite_path
|
|
self.db_fantoir_voies_sqlite_path = db_fantoir_voies_sqlite_path
|
|
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")
|
|
db_insee_communes_sqlite_path = cfg.get("ADDRESSES","db_insee_communes_sqlite_path")
|
|
db_fantoir_voies_sqlite_path = cfg.get("ADDRESSES","db_fantoir_voies_sqlite_path")
|
|
return Config(username, passwd, source_addr,db_insee_communes_sqlite_path, db_fantoir_voies_sqlite_path)
|