initial commit
This commit is contained in:
parent
9eefb4da58
commit
ad82226d8d
1 changed files with 41 additions and 0 deletions
41
Postankuendigung.py
Normal file
41
Postankuendigung.py
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
from imap_tools import MailBox
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
|
||||
def conf():
|
||||
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)
|
||||
return passw
|
||||
|
||||
passw = conf()
|
||||
telegram_chat_id = passw['Telegram']['Chat_ID']
|
||||
telegram_token = passw['Telegram']['TOKEN']
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue