62 lines
747 B
Python
Raw Normal View History

2024-04-19 16:59:43 +00:00
from configparser import ConfigParser
import os
static = """
2024-04-19 19:39:11 +00:00
2024-04-19 16:59:43 +00:00
[general]
2024-04-20 03:43:58 +00:00
name =
2024-04-19 20:02:44 +00:00
phone =
email =
2024-04-19 16:59:43 +00:00
[apps]
dhiraagu = true
ooredoo = true
hdc = true
mwsc = true
stelco = true
medianet = true
[dhiraagu]
2024-04-19 20:02:44 +00:00
phone =
otp =
cookie =
2024-04-19 16:59:43 +00:00
[ooredoo]
2024-04-19 20:02:44 +00:00
phone =
otp =
cookie =
2024-04-19 16:59:43 +00:00
[hdc]
2024-04-19 20:02:44 +00:00
property =
nid =
2024-04-19 16:59:43 +00:00
[mwsc]
2024-04-19 20:02:44 +00:00
meter_no =
account_no =
mobile_no =
2024-04-19 16:59:43 +00:00
[stelco]
2024-04-19 20:02:44 +00:00
account_no =
bill_no =
2024-04-19 16:59:43 +00:00
[medianet]
2024-04-19 20:02:44 +00:00
account_no =
nid =
phone =
2024-04-19 16:59:43 +00:00
"""
2024-04-19 20:02:44 +00:00
2024-04-19 16:59:43 +00:00
class Config(ConfigParser):
def __init__(self) -> None:
super().__init__()
2024-04-19 20:02:44 +00:00
if not os.path.exists('config.ini'):
2024-04-19 16:59:43 +00:00
self.initialize(content=static)
2024-04-19 20:02:44 +00:00
self.read('config.ini')
2024-04-19 16:59:43 +00:00
def initialize(self, content):
2024-04-19 20:02:44 +00:00
with open('config.ini', 'a+') as file:
2024-04-19 16:59:43 +00:00
file.write(content)
2024-04-19 20:02:44 +00:00
config = Config()