-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigmaker.py
79 lines (74 loc) · 2.8 KB
/
configmaker.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/python3
import json, time, getpass
import simplelib.collectionvitallibs as extrafunc
def makeconfig():
print("""\n
.__ .__ __
_____|__| _____ ______ | | _____/ |_ ____ _____ ______
/ ___/ |/ \\____ \| | _/ __ \ __\/ __ \ / \\____ \
\___ \| | Y Y \ |_> > |_\ ___/| | \ ___/| Y Y \ |_> >
/____ >__|__|_| / __/|____/\___ >__| \___ >__|_| / __/
\/ \/|__| \/ \/ \/|__|
\n""")
max_temp = int(input("max temperatur >"))
send_email = input("sender email >")
reciever_email = input("Recipient E-mail >")
smtp_server = input("Smtpserver >")
smtp_port = int(input("Smtpserverport >"))
while True:
email_passwortcheck = getpass.getpass(prompt="email password >")
email_passwortcheck2 = getpass.getpass(prompt="retype email password >")
if email_passwortcheck == email_passwortcheck2:
email_passwort = email_passwortcheck
if len(email_passwort) == 0:
print("password could not be 0 character\nplease retry")
continue
else:
break
elif email_passwortcheck != email_passwortcheck2:
print("PASSWORD ERROR\nboth passwords doesnt match try again")
continue
else:
print("password error")
continue
time1 = int(input("time interval >"))
global confwrite
confwrite = {
"question": True,
"max-temp": max_temp,
"send-email": send_email,
"reciever-email": reciever_email,
"smtp-server": smtp_server,
"smtp-port": smtp_port,
"email-password": email_passwort,
"time": time1
}
def checkasw():
time.sleep(3)
extrafunc.clear()
print("your entered values\n")
print("max temperatur = " + str(confwrite["max-temp"]))
print("sender email = " + str(confwrite["send-email"]))
print("Recipient E-mail = " + str(confwrite["reciever-email"]))
print("Smtpserver = " + str(confwrite["smtp-server"]))
print("Smtpserverport = " + str(confwrite["smtp-server"]))
print("email password = " + str(confwrite["email-password"]))
print("time interval = " + str(confwrite["time"]))
asw1 = input("\nare these values correct ? (yes/no) >")
if asw1 == "yes":
json_object = json.dumps(confwrite, indent=4)
with open("config.json", "w") as outfile:
outfile.write(json_object),
print("goodbye")
time.sleep(2)
exit()
elif asw1 == "no":
extrafunc.clear()
makeconfig()
checkasw()
else:
print("error")
time.sleep(2)
checkasw()
makeconfig()
checkasw()