def sendmail(self): to_add_list = [] if self.bat == 'bvt': bat = 'BVT' elif self.bat == 'ceph_qa': bat = 'Ceph QA Origin' else: bat = 'Custom' subject = "%s Execution %s" % ( bat, CURRENT_DATE_WITHOUT_SPACE) from_addr = '*****@*****.**' patter = re.compile('#') to_add_list = [x for x in settings.SEND_MAIL_LIST if not patter.match(x)] msg = "%s Summary %s\n\n" % (bat, CURRENT_DATE_WITHOUT_SPACE) msg+='Build Version: %s '% self.ceph_version msg+="Total Exection time in seconds: %s\n\n" % self.execution_time msg+="Log Path: %s " %("%s:%s" % (self.get_hostip(), self.log_path + CURRENT_DATE)) msg+="Total Testcases: %s Total Pass: %s Total: Fail: %s\n\n"%(len(self.total_result.keys()), len([x for x in self.total_result.values() if x == 'Pass']), len([x for x in self.total_result.values() if x == 'Fail'])) x = utilities.prettytable(20, self.total_result ,["Testcase", "Result"]) msg+="%s" % x if settings.SMPT_SERVER: mail.sendmail(from_addr, to_add_list, subject, msg, settings.SMPT_SERVER) else: mail.sendmail(from_addr, to_add_list, subject, msg) return
def doAfterBuild(build_config, install_path): file_name = os.path.basename(install_path) subject = u"自动打包 %s (%s)" % (file_name, os.environ["BUILD_TARGET"]) file_name = file_name + ".zip" Utils.cleanFile(file_name) Utils.makeZipFile(file_name, install_path) msg = u"这是一封自动发送的邮件,请不回复" mail_config = config['mail'] if "use_send_firefox" in config.keys() and config["use_send_firefox"]: from ffsend import upload url, owner = upload("https://send.firefox.com/", file_name) file_name = None msg = u"这是一封自动发送的邮件,请不回复!\n您的打包结果下载地址:%s" % (url, ) try_time = mail_config['try_time'] while (try_time > 0): try: try_time = try_time - 1 print "try sendmail @ time:" + str(mail_config['try_time'] - try_time) sendmail(mail_config['smtp_server'], mail_config['smtp_username'], mail_config['smtp_passwd'], mail_config['to_mail'], subject, msg, file_name) break except: pass
def mailtousers(): cur=g.db.execute('select tel,mail from users') row=cur.fetchall() for i in row: sendmail(i) flash('this week orders mails finished~') return redirect(url_for('admin'))
def printdetails(user, predicted, probability): print() print('DETAILED REPORT FOR PATIENT {}'.format(user.name)) print('Diagnosed: {}'.format(label[predicted])) accuracy = probability[predicted] print('Accuracy: {}%'.format(accuracy)) print() if predicted != 'NO' and accuracy > 75: action = 'Booked Follow-up Appointment\nReference for Speciality Hospital also forwarded.\n' print('-'*60) # call Appointment Scheduler Module print('Follow Up Appointment Scheduled with priority : HIGH') print('-'*60) # call reference builder print('Forwarded report for reference with Speciality Hospital') print('-'*60) elif (predicted != 'NO' and accuracy > 50): action = 'Booked Follow-up Appointment' # call Appointment Scheduler Module print('-'*60) print('Follow Up Appointment Scheduled with priority : MODERATE') print('-'*60) else : action = 'Booked Follow-up Appointment' print('-'*60) # call Appointment Scheduler Module print('Follow Up Appointment Scheduled with priority : LOW') print('-'*60) msg = 'Diagnosed: {}\nAccuracy: {}\n{}'.format(label[predicted], accuracy, action) # print(msg, user.email) sendmail(user.email, msg)
def mail(self, path, matched): cur_time = time.strftime("%d-%b-%Y %I:%M:%S%p") bodytext = "Someone possibly accessed the laptop at " + str( cur_time) + "\n" + " Matched keywords: " + str(matched) subject = 'Laptop unlocked/accessed at ' + str(cur_time) sendmail(toaddr=EMAIL_TO, body=bodytext, subject=subject, file=path ) # send file=None if you don't want to send an attachment
def cron_main(): total, over, code = get_best_company() logging.info('total %d, over %d, code: %s', total, over, code) #超过一半行业收红 if over * 2 > total: header = code.split(' ')[0] msg = 'all:' + str(total) + ' over:' + str(over) + ' code:' + code mail.sendmail(header, msg) logging.info('send mail: %s', header)
def analysis(): servers = [ {"server":"10.103.0.1", "path":"/data/platform/collector/apache-flume-1.6.0-bin/logs"}, {"server":"10.103.0.2", "path":"/data/platform/collector/apache-flume-1.6.0-bin/logs"}, ] for s in servers: server = s['server'] path = s['path'] subprocess.call(split('./bin.sh ' + server + ' ' + path)) mail.sendmail()
def SendForgotPasswordMail(user,lang='en'): dbfile = 'users/%s.db' % user db = anydbm.open(dbfile, 'r') mail = db['mail'] pwd = db['pwd'] db.close() subject = subjectsforgotpwd[lang] body = bodiesforgotpwd[lang] % (domain,pwd) sendmail(mail,subject,body) return mail
def SendForgotPasswordMail(user): dbfile = 'data/users/%s.db' % user db = anydbm.open(dbfile, 'r') mail = db['mail'] pwd = db['pwd'] db.close() subject = gettext('ReGePe (Replay your GPS Tracks) forgoten password reminder') body = gettext('You receive this mail because someone has requested a forgotten password reminder from %s.\nYour password is %s') % (config['domain'],pwd) sendmail(mail,subject,body) return mail
def send_email(orm, user, reset_url, mail_type): """ mail_type: register ro resetpw """ secret = user.secret if mail_type=="register" else user.resetpw logger.debug(secret) auth = OtpAuth(secret) uri = auth.to_uri('totp', user.email, 'userga') qrurl = "?".join(['https://chart.googleapis.com/chart', urlencode({'cht': 'qr', 'chs': '200x200', 'chl': uri})]) logger.debug(qrurl) logger.debug(mail_type) sendmail(user.email, secret, uri, qrurl, reset_url, mail_type)
def recv_post_cmnt(): req = request.form.to_dict() postid = str(uuid1()) created_at = datetime.now() content = req["post"] user_id = gu1(request.headers["cookie123"]) subreddit_name = req["subreddit"] if (user_id is not None): ret = ip1(postid, content, created_at, user_id, subreddit_name) sendmail(s, subreddit_name, postid) return ret return "<h>Failure</h>"
def send(self): subject = self.getSubject() body = self.getBody() sendmail( self.email.text(), self.password.text(), self.to.text(), self.cc.text(), self.bcc.text(), subject, body )
def send_fatal(self, error): if config.CONFIG["mail_enabled"]: nl = config.CONFIG["mail_newline"] mail_subject = "FetchFood FAILED!" mail_content = ("A fatal error occurred at:" + nl + nl + datehelper.to_string(datehelper.current_date(), datehelper.PRECISION_DATE) + nl + datehelper.to_string(datehelper.current_date(), datehelper.PRECISION_TIME) + nl + nl + "FATAL ERROR: " + str(error)) if self.has_error: mail_content += (nl + nl + "These additional (non-fatal) errors occurred during program execution:" + nl + self.get_errors_compiled(nl)) print mail_content mail.sendmail(mail_subject, mail_content) sys.exit(1)
def analysis(): servers = [ { "server": "10.103.0.1", "path": "/data/platform/collector/apache-flume-1.6.0-bin/logs" }, { "server": "10.103.0.2", "path": "/data/platform/collector/apache-flume-1.6.0-bin/logs" }, ] for s in servers: server = s['server'] path = s['path'] subprocess.call(split('./bin.sh ' + server + ' ' + path)) mail.sendmail()
def notify(event, context): yesterday = datetime.strftime(datetime.now() - timedelta(1), '%Y-%m-%d') dynamodb = boto3.resource("dynamodb") table = dynamodb.Table('school-covid19-notify') response = table.scan() data_items = response['Items'] for item in data_items: resp = requests.get( 'https://data.ontario.ca/api/3/action/datastore_search?resource_id=8b6d22e2-7065-4b0f-966f-02640be366f2' '&limit=800' '&filters={"school_board":"Peel District School Board","reported_date":"%s", "school":"%s"}' % (yesterday, item["school"])) if resp.json()["result"]["records"]: sendmail(item["email"], item["school"])
def tweet(statusupdate, erroremail): if len(statusupdate) > 140: raise Exception("Status message is too long!") logger.error("Status message was too long!\n\nStatus:\n%s" % statusupdate) sendmail(erroremail, "TWEET ERROR", "Status update for @youraccount has not been posted, update was too long.\n\nStatus:\n%s" % statusupdate) try: result = api.update_status(status=statusupdate) logger.info("Status updated:\n\'%s\'" % statusupdate) print "Status updated:\n\'%s\'" % (result.text) except IOError: exit() except Exception as ex: logger.error("ERROR TWEET WAS NOT POSTED: "+str(ex)) sendmail(erroremail, "TWEET ERROR", "Status update for @youraccount has not been posted, reason given: "+str(ex))
def send(): try: d = {} args = None # Would use request.is_json, but not available in flask < 0.11 D: if request.mimetype in ['application/json','application/*+json']: args = request.get_json(silent=True) if args is None: raise MailError("Invalid JSON", MailError.InvalidJSON) atts = [] if 'attachments' in args: for atch in args['attachments']: if 'data' not in atch: raise MailError("'data' required for attachments.", MailError.InvalidParameter) atch['data'] = b64decode(atch['data']) if 'filename' not in atch: atch['filename'] = '' if 'mimetype' not in atch: atch['mimetype'] = '' atts.append(atch) d['attachments'] = atts elif request.mimetype in ['multipart/form-data', 'application/x-www-form-urlencoded']: # Since we handle json and form inputs together below, # roll duplicate keys into an array. args = {} for key,val in request.form.iterlists(): if len(val) == 1: args[key] = val[0] else: args[key] = val d['attachments'] = [{"filename":atch.filename, "mimetype":atch.mimetype, "data":atch.stream} for atch in request.files.getlist('attachments')] else: raise MailError(request.mimetype + " not supported.", MailError.InvalidMIMEType) for arg in ['sender', 'subject', 'text', 'to']: if arg not in args: raise MailError("Missing parameter '" + arg + "'", MailError.MissingParameter) d.update({'sender': args['sender'], 'subject': args['subject'], 'text': args['text'], }) for arg in ['to','cc','bcc']: if arg in args: # Since form inputs with the multiple attribute will combine these # using ',', handle that. Also support multiple instance of the if isinstance(args[arg], basestring): d[arg] = [x for x in args[arg].split(',') if len(x) > 0] elif isinstance(args[arg], list): d[arg] = [x for x in args[arg] if len(x) > 0] else: raise MailError("Invalid parameter '" + arg + "'. Must be array or string", MailError.InvalidParameter) if len(args['to']) == 0: raise MailError("Missing parameter 'to'.", MailError.MissingParameter); return Response(json.dumps(mail.sendmail(**d)),mimetype="application/json") except MailError as e: return Response(json.dumps({"error": e.errorcode, "message": e.message}), mimetype="application/json", status=e.httpstatus)
def mailService(): try: payload = dict(request.get_json()) name=payload['username'] emailid=payload['emailid'] result=sendmail(name,emailid) return jsonify({"Result":str(result)}) except Exception as e: return jsonify({"Result":str(e)})
def sendMail(): if request.method == 'POST': val = mail.sendmail(request.form['address']) if val != 'failed': session['checkcode'] = val session['email'] = request.form['address'] return '201' else: return '306'
def catch_data(message): p = message.text pp = p.split(' ') name = pp[1] phone = pp[2] email = pp[3] address = pp[4] add_to_base(name, phone, email, address) bot.send_message(message.chat.id, "Регистрация завершена! Ваш заказ поступил в обработку!\n" + "Время заказа: " + str(datetime.datetime.now()) + "\n" + "Имя клиента: " + name + "\n" + "Адрес доставки: " + address + "\n" + "Телефон: " + phone + "\n" + "Почта: " + email + "\n" + "Результат обработки заказов будет отправлен Вам на почту.") global o_status o_status = "Обработка" mail.sendmail(email, name) change_status()
def resetPWD(): email = request.form['email'] u = User(email) status = u.resetPassword() if status['status'] == False: abort(404) pwd = status['password'] try: fp = open('./dash/static/email.txt', 'rb') msg = str(fp.read()) msg = msg.replace('[password]', pwd) sendmail(email, mailsubject, msg) db_session.commit() except: db_session.rollback() abort(500) return ''
def verify(): email = request.args.get("email") email = rsa.decrypt(email).decode() status = request.args.get("status") #register,或者reset if datahandler.isregister( email) and status == 'register': #邮箱已经注册,但用户在注册该邮箱 return json.dumps(-1) elif (not datahandler.isregister(email) ) and status == 'reset': # 邮箱未注册,但用户在重置密码 return json.dumps(-1) else: verify_code = random.randint(100000, 999999) print("生成的验证码:{}".format(verify_code)) cache._set(email, verify_code) mail.sendmail(email, verify_code) return json.dumps(0)
def SignUp(): connection = mysql.connect() cursor = connection.cursor() _mis = request.form['mis'] _fname = request.form['f_name'] _passwd = request.form['passwd_reg'] _email = request.form['email_reg'] _phone = request.form['number_reg'] _salt = generate_random.generate_random() _passwd = _passwd + _salt _passwd = generate_hash.hash(_passwd) os.makedirs(basedir + '/static/uploads/' + _mis) os.makedirs(basedir + '/static/uploads/' + _mis + '/apps') os.makedirs(basedir + '/static/uploads/' + _mis + '/calcy') os.makedirs(basedir + '/static/uploads/' + _mis + '/store') os.makedirs(basedir + '/static/uploads/' + _mis + '/share') query = "INSERT INTO secure_login (email,password,salt,name,number,MIS) VALUES ('" + _email + "','" + _passwd + "','" + _salt + "','" + _fname + "','" + _phone + "','" + _mis + "' )" cursor.execute(query) connection.commit() mail.sendmail(_email) return json.dumps({'status': '200'})
def notify_if_exceed_threshold(self, price, currency): c = self.config['currencies'][currency] if not c.get('notify', False): return if not (self.config['email'] and (c.get('lowop') or c.get('highop'))): temp = 'email: %s. Something not set, email not send' logging.getLogger(currency).info(temp, self.config['email']) return exprs = [] opth = {'lowop': 'low', 'highop': 'high'} for op, th in opth.items(): expr = '{0}{1}{2}'.format(price, c.get(op), c.get(th)) if se.seval(expr): exprs.append(expr) if not len(exprs): return mailopt = {} mailopt['content'] = '\n'.join(exprs) mailopt['to'] = self.config['email'] global LAST_TIME_SEND_MAIL lasttime = LAST_TIME_SEND_MAIL.get(currency) if not lasttime: LAST_TIME_SEND_MAIL[currency] = datetime.now().timestamp() if self.config['debug']: logging.info(mailopt) else: mail.sendmail(**mailopt) else: interval = datetime.now().timestamp() - lasttime if interval > SEND_MAIL_INTERVAL: LAST_TIME_SEND_MAIL[currency] = datetime.now().timestamp() if self.config['debug']: logging.info(mailopt) else: mail.sendmail(**mailopt)
def verify_email(): print("verify mail") from mail import sendmail from hashlib import sha1 from time import gmtime, strftime mail = request.args.get('mail') if mail == None or mail == "": return render_template("verify_resend.html") registered_users = session.query(User).filter(User.priority == 0) user = None for current_user in registered_users: if current_user.id == mail: user = current_user break if user == None: message = "user not found." return render_template("verify.html", info=message) if user.verification == True: message = "your email address has already been verified." return render_template("verify.html", info=message) now = strftime("%Y-%m-%d %H:%M:%S", gmtime()) token = sha1(now + "user " + user.id + "auth").hexdigest() update_user = session.query(User).filter(User.id == mail).\ update({'token': token}) session.commit() token_url = "http://" + EXT_ADDR + ":" + str( PORT) + "/verify_email_input?token=" + token receivers = mail receiver_name = "vatic user" subject = 'Vatic - email confirm' content = render_template("mail_confirm.html", token_url=token_url) content_type = 'html' if sendmail(receivers, receiver_name, subject, content, content_type): message = "check out your mail inbox to verify the email address." return render_template("verify.html", info=message) else: message = "unable to send mail." return render_template("verify.html", info=message)
def __init__(self): #self.init_opener() self.get_dict() self.mail = sendmail() self.mail.login() self.success_time = 0 self.fail_connection_err = 0 self.fail_forbidden = 0 self.fail_UnicodeDecode = 0 self.fail_JSONDecode = 0 self.maxdeep = 0 self.fail_remote = 0 self.success_send = 0 self.fail_send = 0
def logtemphumid(sc): global itr global logtime global logiterations print("Logging Temperature and Humidity") humidity, temperature = Adafruit_DHT.read_retry(sensor, pin) #Check if Humidity is over 100% while (humidity > 100): print("Error: Humidity Exceeded 100%... Correcting") humidity, temperature = Adafruit_DHT.read_retry(sensor, pin) time.sleep(3) #Convert Temperature From Celsius to Fahrenheit temperature = (temperature * 1.8) + 32 #Write data csvwriter(humidity, temperature) #Create and Send Email if (itr >= logiterations): sendmail() csvrewriter() itr = 0 itr += 1 s.enter(logtime, 1, logtemphumid, (sc, ))
def main(): start_time = time.time() errorhandler = error.ErrorHandler() try: entrylist = generate_food_entries(config.TARGET_URL) except http.HTTPException as e: errorhandler.add_error(e, config.ERROR_FATAL["postback"]) entrycount = 0 for url in config.PORTALN_POST_URLS: try: http.post_portaln(url, config.PORTALN_ACTION["clear_table"]) #Clear database table. except http.HTTPException as e: errorhandler.add_error(e, config.ERROR_FATAL["clear_table"]) try: entrycount = post_entries(url, entrylist) except http.HTTPException as e: errorhandler.add_error(e, config.ERROR_FATAL["post_entry"]) total_time = time.time() - start_time nl = config.CONFIG["mail_newline"] mail_content = ("fetchfood.py completed at:" + nl + nl + datehelper.to_string(datehelper.current_date(), datehelper.PRECISION_DATE) + nl + datehelper.to_string(datehelper.current_date(), datehelper.PRECISION_TIME) + nl + nl + "Entries posted: " + str(entrycount) + nl + "Execution time: %.1fs") % total_time if errorhandler.has_error: print("error") mail_content += nl + nl + "These (non-fatal) errors occurred during execution:" + nl + errorhandler.get_errors_compiled() if config.CONFIG["mail_enabled"]: mail.sendmail("FetchFood Completed!", mail_content) elif config.DEBUG: print(mail_content) sys.exit(0)
def tweet(statusupdate, erroremail): if len(statusupdate) > 140: raise Exception("Status message is too long!") logger.error("Status message was too long!\n\nStatus:\n%s" % statusupdate) sendmail( erroremail, "TWEET ERROR", "Status update for @youraccount has not been posted, update was too long.\n\nStatus:\n%s" % statusupdate) try: result = api.update_status(status=statusupdate) logger.info("Status updated:\n\'%s\'" % statusupdate) print "Status updated:\n\'%s\'" % (result.text) except IOError: exit() except Exception as ex: logger.error("ERROR TWEET WAS NOT POSTED: " + str(ex)) sendmail( erroremail, "TWEET ERROR", "Status update for @youraccount has not been posted, reason given: " + str(ex))
def down(k): global v_dic dir = v_dic[k] old_dir = os.getcwd() new_dir = r"onedrive的挂载地址{dir}".format(dir=dir.replace("/","|")) p = getp(k) if not os.path.exists(new_dir): os.makedirs(new_dir) os.chdir(new_dir) print("正在下载{k}".format(k=v_dic[k])) if p == 1: command = r"you-get --format=flv https://www.bilibili.com/video/av{k}".format(k=dec(k)) r = os.system(command) else: for i in range(p): command = r"you-get --format=flv --playlist https://www.bilibili.com/video/av{k}?p={p}".format(k=dec(k),p=i+1) r = os.system(command) if r == 0: print(k+"下载成功") #如不需要邮件提醒功能,请删除下面一行。 mail.sendmail("通知的邮件地址","BiliDown任务通知","「{k}」下载成功,请打开onedrive查看".format(k=v_dic[k])) os.chdir(old_dir) else: print(k+"下载失败")
def reset_password(): if not request.remote_addr in ALLOW_IP: message = "not allow to use this function" return render_template("forget_message.html", info=message) mail = request.args.get('mail') if mail == None or mail == "": return render_template("forget_find.html") registered_users = session.query(User).filter(User.priority == 0) user = None for current_user in registered_users: if current_user.id == mail: user = current_user break if user == None: message = "user not found." return render_template("forget_message.html", info=message) now = strftime("%Y-%m-%d %H:%M:%S", gmtime()) token = sha1(now + "user" + user.id + "reset").hexdigest() expire_time = datetime.datetime.now() + datetime.timedelta(minutes=30) update_user = session.query(User).filter(User.id == mail).\ update({'forgetPasswordToken': token }) update_user = session.query(User).filter(User.id == mail).\ update({'forgetPasswordTokenExpireTime': expire_time}) session.commit() token_url = "http://" + EXT_ADDR + ":" + str( PORT) + "/reset_input?token=" + token receivers = mail receiver_name = "vatic user" subject = 'Vatic - password reset' content = render_template("mail_reset.html", token_url=token_url) content_type = 'html' if sendmail(receivers, receiver_name, subject, content, content_type): message = "check out your mail inbox to reset your password." return render_template("forget_message.html", info=message) else: message = "unable to send mail." return render_template("forget_message.html", info=message)
def sendmail (): mail_from = "" mail_to = "" message = "" code = "" if not request.json: abort(400) if 'from' in request.json: mail_from = request.json['from'] if 'to' in request.json: mail_to = request.json['to'] if 'message' in request.json: message = request.json['message'] if 'code' in request.json: code = request.json['code'] if mail_from != "" and mail_to != "" and message != "" and code != "": if mail.checkcode(code): return mail.sendmail(mail_from, mail_to, message) else: return "code is wrong" else: return "values are empty"
def main(): usage = "usage: %prog -u <username> -p <password> -g <group> -m <email> -l <location>" parser = OptionParser(usage=usage) parser.add_option('-u', '--username', dest='username', type='string', help='specify the username') parser.add_option('-p', '--passwd', dest='passwd', type='string', help='specify the password') parser.add_option('-g', '--group', dest='group', type='string', help='specify the groupName') parser.add_option('-m', '--mail', dest='mail', type='string', help='specify the email address') parser.add_option('-l', '--location', dest='location', type='string', help='specify the location') (options, args) = parser.parse_args() if (options.username == None) | (options.passwd == None) | ( options.group == None) | (options.mail == None): print parser.usage exit(0) if options.location == None: location = u"在烽火通信高新四路研发中心签到啦!" else: location = (options.location).decode("gbk") log4j.init() userName = options.username userPass = options.passwd groupName = (options.group).decode("gbk") to_addr = options.mail status = "fail" start_time = time.strftime('%y-%m-%d %H:%M:%S', time.localtime(time.time())) user = Youqu(userName, userPass) status_list = [] article_preview_details = "" if 0 == user.login(): for group in groupName.split(","): status = "fail" if 0 == user.signIn(groupName=group, position=location): status = "success" status_list.append({"group": group, "status": status}) articles = user.getLatestArticles(19) for article in articles: if 0 == user.articlePreview(article): article_preview_details += ("%-15s : %s\n" % (article["title"], "+1")) else: article_preview_details += ("%-15s : %s\n" % (article["title"], "+0")) stop_time = time.strftime('%y-%m-%d %H:%M:%S', time.localtime(time.time())) msg_content = "" msg_content += ("%-07s: %s\n" % ("user", userName)) for item in status_list: msg_content += ("%-07s: %s ===> %s\n" % ("group", item["group"], item["status"])) msg_content += ("%-07s: %s\n" % ("start", start_time)) msg_content += ("%-07s: %s\n" % ("stop", stop_time)) msg_content += ("\n" + ("*" * 80) + "\n") msg_content += article_preview_details sendmail(to_addr=to_addr, content=msg_content)
import os start = time.clock() srcpath = '/home/wwwroot/default/wp-content/uploads/backwpup/' targetpath = '/root/************/app/backup_wp' os.system('mv %s/*.tar.gz %s' %(srcpath,targetpath)) from filestore import filestore f = filestore() f.list_files() print f.resultfile from pcs import baidupcsbak from mail import sendmail bd = baidupcsbak('************') bd.connPCS() for ff in f.resultfile: bd.upload_file(ff,'/apps/************/%s' %(ff)) f.removefile(ff) print bd.pcsflag, bd.filesize end = time.clock() runtimer = end - start if bd.pcsflag: sendmail(True, runtimer) else: sendmail(False, runtimer)
def SendActivationMail(mail,user,activation_id,lang='en'): subject = subjects[lang] body = bodies[lang] % (domain,user,activation_id) sendmail(mail,subject,body)
msg = msg + txt + ' Declared' #print 'hieee' msg = ' '.join(msg.split()) if "BE SEM 8 - Regular (DEC 2017)" in msg and sem8rem: send = "Result of BE SEM 8 - Regular (DEC 2017) Exam Declared. Check Here--> http://bit.ly/GtuResult All The Best From : KePy" header = "Result Declared" try: sql=("select emailid from studentdetails where semester = 8") cursor.execute(sql) data=cursor.fetchall() for row in data: print(row[0]) sendmail (send,row[0],header) except Exception as e: print("Exception In send MAIL" +str(e)) try: sql=("select mobile from studentdetails where semester = 8") cursor.execute(sql) data=cursor.fetchall() q=w.sms() for row in data: q.send(row[0],send) n=q.msgSentToday() print("Sms Sent" +row[0]) except Exception:
def _handleEndMeeting(endMeetingEvent): meeting = state.get_obj(endMeetingEvent.params["meeting"], model.Meeting) # we need to stop the current topic for data purity reasons currentTopic = meeting.getCurrentTopic() if(currentTopic != None): endTopicEvent = e.Event("UPDATE_TOPIC", endMeetingEvent.actor.uuid, meeting.uuid, params={"topicUUID":currentTopic.uuid, "status":"PAST"}) # do this first so we don't have a current topic hanging around anymore # which will cause lingering issues with the organize-ideas-by-topic # code below. endTopicEvent.dispatch() # do a few sideeffecting things that, if done first, will start breaking # any future events related to this meeting. meeting.room.currentMeeting = None meeting.room = None # load the template # can probably speed this up by making this a global thing and loading # the template once, but for now this is rare + fine. loader = template.Loader("templates") t = loader.load("timeline.html") # do some other variable prep work metadata = {} metadata["meetingStart"] = meeting.eventHistory[0].timestamp metadata["meetingEnd"] = meeting.eventHistory[-1].timestamp # run through all the events to filter out stuff we don't want to show # for now, this is just personally created ideas. That shouldn't be # available to end-users. outEvents = [] for event in meeting.eventHistory: if event.eventType == EventType.types["NEW_TASK"]: if event.params["createInPool"]: outEvents.append(event) elif event.eventType == EventType.types["RESTART_TOPIC"]: # try to do something fancy about removing the "NEW TOPIC" for # this topic, so we don't get two entries for it? For now, just # exclude it. pass else: outEvents.append(event) # do a pass on topics, too, sorting them based on start time (if it has # one) otherwise, put it at the end. futureTopics = [] pastTopics = [] for topic in meeting.topics: if(topic.status == "FUTURE"): futureTopics.append(topic) else: # capture both current and past here pastTopics.append(topic) # now sort pastTopics based on startTime. pastTopics.sort(key=lambda topic:topic.startTime) # put the lists back together. outTopics = pastTopics + futureTopics # now we want to cluster the data around topics, so we have a topic-based # view of what happened in the meeting. The data structure will be a list # (sorted by time) of dictionaries, where each dictionary has two keys: # a topic object, and a list of ideas that happened inside that topic. # we'll construct this by maintaining two separate lists. # skip the whole assignment process if no topics actually were ever # started. if(len(pastTopics)==0): done = True topicsDict = [] for topic in futureTopics: topicsDict.append({"topic":topic, "ideas":[]}) else: done = False topicsDict = [] curTopic = pastTopics[0] curTopicDict = {"topic":curTopic, "ideas":[]} eventIndex = 0 # start on the first topic topicIndex = 0 # in retrospect, this is a really stupidly involved way to do this. it's # efficient, but who cares? I should have while not done: # get the next event (assuming the event index gets incremented, # which you can skip if you want to keep processing a previous # event. this happens when the topic changes.) try: event = outEvents[eventIndex] except: logging.debug("Dropping out of loop - at end of event list.") topicsDict.append(curTopicDict) # check and see if there are any remaining topics. If there are, # we need to add them on with empty idea lists. # if the current eventIndex is not the last item, # then we have topics left that don't have events # in them, but should still be on the list while (topicIndex != len(pastTopics)-1): topicIndex = topicIndex+1 # loop through remaining topics and add them on curTopic = pastTopics[topicIndex] curTopicDict = {"topic":curTopic, "ideas":[]} topicsDict.append(curTopicDict) done = True # skip anything that's not a new idea or wasn't created in the # general pool logging.debug("current event: " + str(event)) if event.eventType != EventType.types["NEW_TASK"]: eventIndex = eventIndex+1 continue # at this point we know it's a new_task, so check and see if it's # going to the main pool if(not event.params["createInPool"]): eventIndex = eventIndex+1 continue # loop through all the events. Look only for NEW_TASK events. # (side question - what to do about ideas that happen before # the first topic starts? for now throw them out.) # (going to need to think about whether it's a group idea or # not at some point) if (curTopic.startTime < event.timestamp and \ curTopic.stopTime > event.timestamp): # if the event is between the current topics start and stop times # then add it to the ideas list and move to the next event. logging.debug("Adding event " + str(event) + " to cur topic "+ \ str(curTopic)) # we might be able to just use the Task object directly but I'm # not 100% sure, so bounce it off the state manager. curTopicDict["ideas"].append(state.get_obj( event.results["task"].uuid, model.Task)) eventIndex = eventIndex+1 elif (curTopic.stopTime < event.timestamp): logging.debug("Found an event beyond the topic's stop time") # first, save this topic in the main dict topicsDict.append(curTopicDict) # if this is the case, then we need to move onto the next topic # without advancing the event counter. if((topicIndex+1) < len(pastTopics)): logging.debug(" there are more topics to process, advanting current topic!") topicIndex = topicIndex+1 curTopic = pastTopics[topicIndex] curTopicDict = {"topic":curTopic, "ideas":[]} else: # we've hit the end of the topic list, drop out done = True elif (curTopic.startTime > event.timestamp): # this should only happen for events that happen before the first # topic starts. Just ignore these. logging.debug("Found an event that happens before the topic:" + \ str(event) + " (before topic " + str(curTopic) + ")") eventIndex = eventIndex+1 logging.debug("-------- DONE PROCESSING TOPICS + IDEAS----------") logging.debug("topicsDict: ") logging.debug(topicsDict) # run it with the current meeting. results = t.generate(meeting=meeting, metadata=metadata,events=outEvents, topics = outTopics, topicsDict=topicsDict) # now write it out to disk meetingEndTime = int(time.time()) filename = str(meetingEndTime) + ".html" out = open("static/archive/" + filename, 'w') out.write(results) # now we want to email everyone a link to the file + some personalized # information relevant to them. Mainly, we want to send people the list # of stuff in their idea drawer. # also write this out to disk so we don't lose them in the case of email # troubles. os.mkdir("static/archive/" + str(meetingEndTime)) for user in meeting.allParticipants: # compose and send the email. body = "Hi " + user.name + ",\n\n" body = body + "You can find the timeline from today's class here:\n\n" body = body + "http://" + util.config.get("server", "domain") + \ "/static/archive/" + filename + "\n\n" body = body + "Here are all the ideas you had in \ your bin: \n" taskString = "" for task in user.tasks: taskString = taskString + " - " + task.text + "\n" # write the taskString out to disk taskFile = open("static/archive/" + str(meetingEndTime) + "/" + \ str(user.email) + ".txt", 'w') taskFile.write(taskString) taskFile.close() body = body + taskString # for now hardcode my email address in, but later use a real one mail.sendmail(util.config.get("email", "from_email"), user.name + " - today's class timeline", body) return event
def email(body): if settings.isset('mailDSOLto'): to = settings.get('mailDSOLto') subject = 'SkuTouch could not validate orders from Dance Shoes Online' print('Sending email to ' + to) mail.sendmail(to, subject, body)
debug = os.getenv('DEBUG', 'false') if debug == 'true': recipients = ["*****@*****.**"] else: recipients = ["*****@*****.**"] print("starting.Debug is :" + debug) startup.tpys() startup.init() var = 1 while var == 1: if debug == 'true': time.sleep(10) else: time.sleep(600) if control.is_there_new_announce(0) == 1: screenshot.print_announcement(control.take_link(0)) for recipient in recipients: mail.sendmail(recipient, control.take_link(0)) startup.init() else: if debug == 'true': print(str(datetime.datetime.now()) + " there is no new announce.")
if newTweets != None and newTweets != []: emailsubject = "Twitter Bot Status Update" emailbody += "%s new Tweets left in database:\n\n%s" % (len(newTweets), newTweets) logger.info("%s new tweets were retrieved." % len(newTweets)) else: emailsubject = "TWITTER BOT DATABASE ERROR" emailbody += "No new tweets left in database! Add more ASAP!" logger.error("No new tweets left in database!") #setting next tweet nextTweet = newTweets[0] logger.debug("Set next tweet to \'%s\'" % nextTweet) logger.debug("Sending annual email to %s..." % emailrecipient) #sending annual email to myself to make sure everything is running smoothly sendmail(emailrecipient, emailsubject, emailbody) logger.info("Checking time...") #checktime sleeps until the given hours in the parameters checktime(tweettimes[0],tweettimes[1]) #these are for debugging #print "sleeping" #sleep(30) logger.info("Tweeting...") #emailrecipient is needed because if there is a tweet error, it will send to that email tweet(nextTweet, emailrecipient) logger.info("Adding Tweet to pasttweets.txt...") #adding tweet that was just tweeted to past tweets
i=1 while i != 0: msg = getmail() if msg != "empty box": print ">>> Subject: ", msg['Subject'] adr = msg["From"].split("<")[1].split(">")[0] if adr != settings.Supplier_email_down: if adr in settings.Cust_mail: key_index = settings.Cust_mail.index(adr) #msg.replace_header("Subject",msg['Subject']+' ^*' + settings.Cust_key[key_index]+ '*^') msg = set_marker(settings.Cust_key[key_index],msg) msg = rebuild (msg) msg['To'] = settings.Supplier_email print '>>> Up stream from:',adr, settings.Cust_key[key_index] sound.upstream() sendmail(settings.Broker_email, settings.Supplier_email, msg) sendmail(settings.Broker_email, settings.Supervisor_mail, msg) else: print '>>> Spam from:', adr else: #sub = msg['Subject'] #key = sub[sub.find('^*')+2:sub.find('*^')] key = get_marker(msg) key_index = settings.Cust_key.index(key) #msg.replace_header("Subject",sub[:sub.find('^*')-1]) msg = clear_marker(key,msg) msg = rebuild (msg) msg['To'] = settings.Cust_mail[key_index] print'>>> Down stream to:', msg['To'] sound.downstream() sendmail(settings.Broker_email, settings.Cust_mail[key_index], msg)
parser.add_argument('-r','--remote_host',help="Transmit tracking photo \ to this") parser.add_argument('-m','--mail', help="Send pictures to ") args=parser.parse_args() topic="Session started @%s"%time.ctime() try: while True: with picamera.PiCamera() as camera: camera.resolution = (CAMERA_WIDTH, CAMERA_HEIGHT) camera.hflip = CAMERA_HFLIP camera.vflip = CAMERA_VFLIP filename="footageAt%s.png"%(int(time.time())) camera.capture(filename) print("Photo saved:%s"%filename) if args.remote_host is not None: subprocess.call(['scp',filename,args.remote_host]) if args.mail is not None: content=time.ctime() sendmail(args.mail,topic,content,filename) time.sleep(args.interval) except KeyboardInterrupt: pass
def email(body): if settings.isset('mailstacksocialto'): to = settings.get('mailstacksocialto') subject = 'SkuTouch could not validate orders from StackSocial' print('Sending email to ' + to) mail.sendmail(to, subject, body)
def SendActivationMail(mail,user,activation_id): subject = gettext('ReGePe (Replay your GPS Tracks) account creation') body = gettext('Your accound will be created when you visit http://%s/activate/%s/%s') % (config['domain'],user,activation_id) sendmail(mail,subject,body)
else: vent = a[0] mer = '' #houle = r['houle'].encode(encoding='latin_1',errors='ignore') if r.has_key('houle') and r['houle']!=None: houle = r['houle'].encode('latin_1') else: houle = '' #temps = r['ts'].encode(encoding='latin_1',errors='ignore') if r.has_key('ts') and r['ts']!=None: temps = r['ts'].encode('latin_1') else: temps = '' out.append((titre_echeance,titre_region,vent,mer,houle,temps)) return (chapeau_bulletin,out) print('Content-Type: text/html') print try: chapeau_bulletin,contents = get_bulletin() body = '\n\n'.join(map(lambda itm:'%s %s\n%s\n%s\n%s\n%s' % itm,contents)) subject = chapeau_bulletin.replace('Origine Météo-France<br />','[MtoFrMarine] ') except Exception, e: print 'Error %s'%e print('</p><pre><small>%s</small></pre></body></html>' % traceback.format_exc()) print subject print body sendmail('*****@*****.**',subject,body) print 'Mail sent'
def email(body): if settings.isset("mailstacksocialto"): to = settings.get("mailstacksocialto") subject = "SkuTouch could not validate orders from StackSocial" print("Sending email to " + to) mail.sendmail(to, subject, body)
def issueBook(): if (len(enrollment_no.get()) <= 0 and len(faculty_id.get()) <= 0): enrlmnandfacultytstudent_msg = tkinter.messagebox.showinfo( "Library Management System", "Please Enter ENROLLMENT_NO or FACULTY ID!") if (len(book_id.get()) == 0): unqbkidstudent_msg = tkinter.messagebox.showinfo( "Library Management System", "Please Enter Book ID!") elif (len(enrollment_no.get()) >= 1 and len(faculty_id.get()) >= 1): student_msg = tkinter.messagebox.showinfo( "Library Management System", "Please Enter ENROLLMENT_NO or FACULTY ID! Not Both!") else: studentIsValid = 0 faculty_idIsValid = 0 uniqueBookIdIsValid = LMS_verification.uniqueBookIdIsValid( book_id.get()) if (uniqueBookIdIsValid != 1): student_msg = tkinter.messagebox.showinfo( "Library Management System", "Book ID Not Exist!") if (len(enrollment_no.get()) >= 1): studentIsValid = LMS_verification.studentIsValid( enrollment_no.get()) if (len(enrollment_no.get()) >= 2): if (studentIsValid == 1): student_id = LMS_verification.get_student_id( enrollment_no.get()) print("student is valid") student_email = LMS_verification.getStudentEmailForSendingEmail( enrollment_no.get()) student_fullname = LMS_verification.getStudentFullnameForSendingEmaill( enrollment_no.get()) print(student_fullname) else: student_msg = tkinter.messagebox.showinfo( "Library Management System", "Invalid ENROLLMENT_NO!") if (len(faculty_id.get()) >= 1): faculty_idIsValid = LMS_verification.faculty_idIsValid( faculty_id.get()) if (len(faculty_id.get()) >= 1): if (faculty_idIsValid == 1): print("faculty_id is valid") faculty_email = LMS_verification.getFacultyEmailForSendingEmail( faculty_id.get()) faculty_fullname = LMS_verification.getFacultyFullnameForSendingEmail( faculty_id.get()) print(faculty_fullname) else: student_msg = tkinter.messagebox.showinfo( "Library Management System", "Invalid FACULTY ID.!") if (uniqueBookIdIsValid == 1 and (studentIsValid == 1 or faculty_idIsValid == 1)): if (uniqueBookIdIsValid == 1 and studentIsValid == 1): enrollment = enrollment_no.get() unique_book_id = book_id.get() bk_id = LMS_verification.get_book_id_for_issue( book_id.get()) print("bk_id", bk_id) book_quantity = LMS_verification.get_quantity_for_update_books( bk_id) (book_quantity) issued_current_book = LMS_verification.issued_current_book( unique_book_id) print(issued_current_book) print("ss", int(book_quantity)) print("ss", int(issued_current_book)) if (int(book_quantity) - int(issued_current_book) > 0): student_issued_books = LMS_verification.student_issued_books( student_id) book_already_issued = LMS_verification.book_already_issued( unique_book_id) if (student_issued_books >= 2): tkinter.messagebox.showinfo( "Library Management System", "Student Has Issued Two Books Already") elif (book_already_issued == 1): tkinter.messagebox.showinfo( "Library Management System", "Book Issued By Other Student/Faculty") else: issue_date = date.today() actual_return_date = date.today() + timedelta( days=15) print(actual_return_date) status = "issued" LibBksDatabase.addIssueReturn( student_id, unique_book_id, issue_date, actual_return_date, status) tkinter.messagebox.showinfo( "Library Management System", "Book Issued Successfully!") student_msg = "Hello " + student_fullname + "(" + enrollment + ")" + ".\nYou Have Issued a book.\nKindly Return it Before " + str( actual_return_date) + ".\nThank you.!!" try: mail.sendmail(student_email, student_msg) except socket.gaierror as a: tkinter.messagebox.showinfo( "Library Management System", "Email Coudnt Sent! You Are Not Connected with the Internet." ) else: pass DisplayData() elif (int(book_quantity) - int(issued_current_book) == 0): print( int(book_quantity) - int(issued_current_book)) qntynstudent_msg = tkinter.messagebox.showinfo( "Library Management System", "Sorry! Book Out Of Stock") else: qntynstudent_msg = tkinter.messagebox.showinfo( "Library Management System", "Something Went Wrong") elif (uniqueBookIdIsValid == 1 and faculty_idIsValid == 1): unique_book_id = book_id.get() f_id = faculty_id.get() bk_id = LMS_verification.get_book_id_for_issue( book_id.get()) book_quantity = LMS_verification.get_quantity_for_update_books( bk_id) issued_current_book = LMS_verification.issued_current_book( unique_book_id) print(issued_current_book) if (int(book_quantity) - int(issued_current_book) > 0): faculty_issued_books = LMS_verification.faculty_issued_books( f_id) print(faculty_issued_books) book_already_issued = LMS_verification.book_already_issued( unique_book_id) print("knjn ", book_already_issued) if (faculty_issued_books >= 2): tkinter.messagebox.showinfo( "Library Management System", "Faculty Already Has Issued Two Books") elif (book_already_issued == 1): tkinter.messagebox.showinfo( "Library Management System", "Book Issued By Other Student/Faculty") else: issue_date = date.today() actual_return_date = date.today() + timedelta( days=15) print(actual_return_date) status = "issued" LibBksDatabase.bookIssueFaculty( f_id, unique_book_id, issue_date, actual_return_date, status) tkinter.messagebox.showinfo( "Library Management System", "Book Issued Successfully!") DisplayData() faculty_msg = "Hello " + faculty_fullname + "(" + f_id + ")" + ".\nYou Have Issued a book.\nKindly Return it Before " + str( actual_return_date) + ".\nThank you.!!" try: mail.sendmail(faculty_email, faculty_msg) except socket.gaierror as a: tkinter.messagebox.showinfo( "Library Management System", "Email Coudnt Sent! You Are Not Connected with the Internet." ) else: pass elif (int(book_quantity) - int(issued_current_book) == 0): print( int(book_quantity) - int(issued_current_book)) qntynstudent_msg = tkinter.messagebox.showinfo( "Library Management System", "Sorry! Book Out Of Stock") else: qntynstudent_msg = tkinter.messagebox.showinfo( "Library Management System", "Something Went Wrong")
parser.add_argument('-r', '--remote_host', help="Transmit tracking photo \ to this") parser.add_argument('-m', '--mail', help="Send pictures to ") args = parser.parse_args() topic = "Session started @%s" % time.ctime() try: while True: with picamera.PiCamera() as camera: camera.resolution = (CAMERA_WIDTH, CAMERA_HEIGHT) camera.hflip = CAMERA_HFLIP camera.vflip = CAMERA_VFLIP filename = "footageAt%s.png" % (int(time.time())) camera.capture(filename) print("Photo saved:%s" % filename) if args.remote_host is not None: subprocess.call(['scp', filename, args.remote_host]) if args.mail is not None: content = time.ctime() sendmail(args.mail, topic, content, filename) time.sleep(args.interval) except KeyboardInterrupt: pass
def returnBook(): if (len(book_id.get()) == 0): unqbkidstudent_msg = tkinter.messagebox.showinfo( "Library Management System", "Please Enter Book ID!") book_id_is_valid = 0 elif (len(book_id.get()) != 7): unqbkidstudent_msg = tkinter.messagebox.showinfo( "Library Management System", "Please Enter 7 Digit Book ID!") book_id_is_valid = 0 elif (len(enrollment_no.get()) == 0): unqbkidstudent_msg = tkinter.messagebox.showinfo( "Library Management System", "Please Enter Enrollment No.!") else: book_id_is_valid = 1 studentIsValid = 0 Bookissued = LMS_verification.Bookissued(book_id.get()) if (not (Bookissued == 1)): tkinter.messagebox.showinfo("Library Management System", "Invalid Book ID!") else: if (len(enrollment_no.get()) >= 2): studentIsValid = LMS_verification.studentIsValid( enrollment_no.get()) if (studentIsValid == 1): student_id = LMS_verification.get_student_id( enrollment_no.get()) print("student is valid") student_email = LMS_verification.getStudentEmailForSendingEmail( enrollment_no.get()) student_fullname = LMS_verification.getStudentFullnameForSendingEmaill( enrollment_no.get()) print(student_fullname) else: student_msg = tkinter.messagebox.showinfo( "Library Management System", "Invalid ENROLLMENT_NO!") '''if (not(Bookissued!=1) and (not(studentIsValid==1))): print("guuuuuuuuuuud") else: tkinter.messagebox.showinfo("Library Management System", "Something Went Wrong")''' get_student_id = LMS_verification.get_student_id( enrollment_no.get()) checkForValidStudentHasIssuedBook = LMS_verification.checkForValidStudentHasIssuedBook( book_id.get(), get_student_id) print(checkForValidStudentHasIssuedBook) if (checkForValidStudentHasIssuedBook != 1): tkinter.messagebox.showinfo( "Library Management System", "Check ENROLLMENT NO. and Book Id.") else: unique_book_id = book_id.get() book_detail = LMS_verification.get_book_detail_for_return( unique_book_id) print(book_detail) return_date = date.today() if (not (book_detail[0][1] == None)): status = "returned" get_stu_id = LMS_verification.get_student_id( enrollment_no.get()) get_return_date = LMS_verification.get_return_date( book_id.get(), get_stu_id) #issued_date = datetime.strptime(book_detail[0][4], '%Y-%m-%d').date() issued_date = datetime.strptime( get_return_date, '%Y-%m-%d').date() print("get_return_date", get_return_date) print("issued_date", issued_date) diff = return_date - issued_date print("r ", return_date) print("i ", issued_date) print(diff) if (diff.days >= 16): email = LMS_verification.getStudentEmailForSendingEmail( enrollment_no.get()) u_book_id = LMS_verification.getBookIdForInvoice( unique_book_id) print("book_id: ", u_book_id) book_name = LMS_verification.getBookNameForInvoice( u_book_id) print("book_name ", book_name) fee = LMS_verification.fee_calc(diff.days) fee_msg = tkinter.messagebox.askyesno( "Library Management System", "Sorry! You Are " + str(diff.days) + " Days Late To Return The Book. Have Student/Faculty Paid Fine ₹" + str(fee) + "?") print(fee_msg) if (fee_msg == 1): paid = 1 rec.fee_invoice(fee, unique_book_id, email, book_name, paid) LibBksDatabase.returnBook( unique_book_id, return_date, status) tkinter.messagebox.showinfo( "Library Management System", "Returned Book Successfully!") DisplayData() student_msg = "Hello " + student_fullname + "(" + enrollment_no.get( ) + ")" + ".\nYou Have Succesfully Returned The Book." try: mail.sendmail(student_email, student_msg) except socket.gaierror as a: tkinter.messagebox.showinfo( "Library Management System", "Email Coudnt Sent! You Are Not Connected with the Internet." ) else: pass elif (fee_msg == 0): paid = 0 rec.fee_invoice(fee, unique_book_id, email, book_name, paid) fee_msg = tkinter.messagebox.showinfo( "Library Management System", "Please Pay The Fine ₹" + str(fee)) else: pass else: LibBksDatabase.returnBook( unique_book_id, return_date, status) tkinter.messagebox.showinfo( "Library Management System", "Returned Book Successfully!") student_msg = "Hello " + student_fullname + "(" + enrollment_no.get( ) + ")" + ".\nYou Have Succesfully Returned The Book." try: mail.sendmail(student_email, student_msg) except socket.gaierror as a: tkinter.messagebox.showinfo( "Library Management System", "Email Coudnt Sent! You Are Not Connected with the Internet." ) else: pass DisplayData() elif (not (book_detail[0][2] == None)): status = "returned" LibBksDatabase.returnBook(unique_book_id, return_date, status) tkinter.messagebox.showinfo( "Library Management System", "Returned Book Successfully!") DisplayData() else: print("Something Went Wrong")