53 lines
670 B
Python
53 lines
670 B
Python
from configparser import ConfigParser
|
|
import os
|
|
|
|
static = """
|
|
[general]
|
|
name =
|
|
phone =
|
|
email =
|
|
|
|
[apps]
|
|
dhiraagu = true
|
|
ooredoo = true
|
|
hdc = true
|
|
mwsc = true
|
|
stelco = true
|
|
medianet = true
|
|
|
|
[dhiraagu]
|
|
phone =
|
|
otp =
|
|
cookie =
|
|
|
|
[ooredoo]
|
|
phone =
|
|
otp =
|
|
cookie =
|
|
|
|
[hdc]
|
|
property =
|
|
nid =
|
|
|
|
[mwsc]
|
|
|
|
|
|
[stelco]
|
|
|
|
|
|
[medianet]
|
|
"""
|
|
|
|
class Config(ConfigParser):
|
|
def __init__(self) -> None:
|
|
super().__init__()
|
|
if not os.path.exists("config.ini"):
|
|
self.initialize(content=static)
|
|
self.read("config.ini")
|
|
|
|
def initialize(self, content):
|
|
with open("config.ini", 'a+') as file:
|
|
file.write(content)
|
|
|
|
|
|
config = Config() |