-
Notifications
You must be signed in to change notification settings - Fork 0
/
Zugangsdaten.py
34 lines (30 loc) · 895 Bytes
/
Zugangsdaten.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import json
import os
import sys
appname = os.path.basename(sys.argv[0])
appname = appname.replace(".py", ".conf")
absFilePath = os.path.abspath(__file__)
absFilePath = absFilePath.replace(".py", ".conf")
if os.path.isfile(absFilePath) is False:
print(appname + ' scheint es nicht zu geben.')
print('Ich lege eine neue Datei ' + appname + ' an.')
passw={'mail':
{
"mail_pass": "",
"mail_user": "",
"mail_host": "",
"mail_folder": ""
},
'Telegram':
{
"Chat_ID": "",
"TOKEN": ""
}
}
print(str(appname) + ' bitte entsprechend befüllen.')
with open(absFilePath, 'w') as fp:
json.dump(passw, fp, sort_keys=True, indent=4)
quit()
else:
with open(absFilePath) as file:
passw = json.load(file)