Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
4006_deffer_project-email/interface.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
180 lines (138 sloc)
6.5 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from tools import email_client as f | |
import Email_db as u | |
def main(): | |
check1="y" #for loop condition | |
while check1=="y": | |
acs=input("enter the acess you have\n\n" | |
"1.Admin\n\n" | |
"2.client\n\n" | |
) | |
if acs=='1': #for admin access | |
pas=input("enter the password") | |
if pas=="1234": #checking password | |
re="n" | |
while re=="n": # beging loop | |
act=input("which action you want to perform\n" | |
"1.Add user\n\n" | |
"2.Remove user\n\n" | |
"3.Update user content \n\n" | |
"4.Select user\n\n" | |
"5.Select all user\n\n" | |
"6.Update user subf\n\n" | |
"7.send updates to all user\n\n" ) | |
if act=="1": # for input 1 | |
f.email_id=input("input email") | |
f.options=input("input options") | |
f.subf=input("enter the Frequency") | |
usr_4 = u.email_client(f.email_id, f.options, f.subf) | |
u.ins_usr(usr_4) | |
print("user added") | |
elif act=="2": # for input 2 | |
f.email_id=input("enter email") | |
usr_4=u.user_info(f.email_id) | |
u.remove_usr(usr_4) | |
print("user removed") | |
elif act=="3": # for input 3 | |
f.email_id = input("enter email") | |
f.options =input("enter options to update1") | |
u.upd_options(f.email_id, f.options) | |
print("options updated") | |
elif act=="4": # for input 4 | |
f.email_id = input("enter email") | |
usr_4 = u.user_info(f.email_id) | |
print(usr_4) | |
elif act=="5": # for input 5 | |
usr_all=u.Alluser_info() | |
print(usr_all) | |
elif act=="6": # for input 6 | |
f.email_id = input("enter email") | |
f.options = input("enter frequency to update") | |
u.upd_options(f.email_id, f.options) | |
print("subf updated") | |
elif act=="7": # for input 7 | |
usr_all = u.Alluser_info() | |
elist=(usr_all) | |
for i in range(len(elist)): | |
content = f.api_content(elist[i][1]) | |
f.email_content(elist[i][0], content) | |
re=input("do you want to exit y/n") | |
if re=='y': | |
exit() | |
#else: | |
elif acs=="2": # for client access | |
check2="y" | |
while check2=="y": #loop condition | |
opt=input("enter your choice\n\n" | |
"1.add email\n\n" | |
"2.update options\n\n" | |
"3.update subf\n\n") | |
if opt=="1": # for option 1 | |
ans = "y" | |
while ans=="y":#loop condition | |
print('hello welcome to email service \n') | |
f.email_id=input("enter your email address\n") | |
e=f.verification(f.email_id) | |
if(e==0): | |
print("service locked") | |
exit() | |
else: | |
print('what all content you wan to explore\n') | |
f.options=str(input('input the topic you want to subscribe(tested keywords bitcoin/stocks')) | |
print(f.options) | |
f.subf=input("enter the frequency in which you want recive the anocement and news letter \n" | |
"1.minutly\n" | |
" 2.hourly\n" | |
" 3.Daily\n" | |
"4.weekly\n") | |
usr_4 = f(f.email_id, f.options, f.subf) | |
u.ins_usr(usr_4) | |
insta=input("would you like a instant update y/n ") | |
if (insta=="y"): # for instant update | |
content=str(f.api_content(f.options)) | |
f.email_content(f.email_id, content) | |
else: | |
print("not a valid input") | |
ans=input("would you like another email to be added n\y") #exit option | |
if ans=='y': | |
continue | |
else: | |
f.email_frequency(f.subf) | |
elif opt=="2": #client upadte options | |
f.email_id = input("enter your email address\n") | |
e = f.verification(f.email_id) | |
if (e == 0): | |
print("service locked") | |
exit() | |
f.email_id = input("enter email once more") | |
f.options = input("enter options to update1") | |
u.upd_options(f.email_id, f.options) | |
print("options updated") | |
elif opt=="3": #client upadte subf | |
f.email_id = input("enter your email address\n") | |
e = f.verification(f.email_id) | |
if (e == 0): | |
print("service locked") | |
exit() | |
f.email_id = input("enter email once more") | |
f.options = input("enter frequency to update") | |
u.upd_options(f.email_id, f.options) | |
print("subf updated") | |
else: | |
print('invalid input') | |
check2=input("do you want run again y/n") #exit condition | |
if check1 == "y": | |
print("running again") | |
else: | |
print("exiting") | |
exit() | |
else: | |
print('invalid input') | |
check1=(input("do you to run again y/n")) #exit condition | |
if check1=="y": | |
print("running again") | |
else: | |
print("exiting") | |
exit() | |
if __name__=='__main__': | |
sys.exit(main()) |