From cac14d6a933571955011d132820486a07a5a76c5 Mon Sep 17 00:00:00 2001 From: hubobel Date: Thu, 24 Feb 2022 22:41:23 +0100 Subject: [PATCH] =?UTF-8?q?Ausgabe=20der=20neuen=20DB=20Eintr=C3=A4ge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zugangsdaten.conf | 8 ++++++++ Zugangsdaten.py | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 Zugangsdaten.conf create mode 100644 Zugangsdaten.py diff --git a/Zugangsdaten.conf b/Zugangsdaten.conf new file mode 100644 index 0000000..80c898f --- /dev/null +++ b/Zugangsdaten.conf @@ -0,0 +1,8 @@ +{ + "Chat_ID": "", + "TOKEN": "", + "mail_folder": "", + "mail_host": "", + "mail_pass": "", + "mail_user": "" +} \ No newline at end of file diff --git a/Zugangsdaten.py b/Zugangsdaten.py new file mode 100644 index 0000000..cca0c65 --- /dev/null +++ b/Zugangsdaten.py @@ -0,0 +1,20 @@ +import json +import os +import sys +conf = os.path.basename(sys.argv[0]) +conf = conf.replace(".py", ".conf") +if os.path.isfile(conf) is False: + print(conf + ' scheint es nicht zu geben.') + print('Ich lege eine neue Datei '+ conf + ' an.') + passw={"mail_pass": "","mail_user": "", + "mail_host": "", + "mail_folder": "", + "Chat_ID": "","TOKEN": "" + } + print(str(conf)+ ' bitte entsprechend befüllen.') + with open(conf, 'w') as fp: + json.dump(passw, fp, sort_keys=True, indent=4) + quit() +else: + with open(conf) as file: + passw = json.load(file) \ No newline at end of file