def __init__(self): try: self.serversocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.soldier = Target() self.serversocket.bind(('0.0.0.0', 8081)) self.serversocket.setblocking(False) self.should_run = True self.command = '' self.targets = {} self.address = conf.HOLOLENC_ADDR self.db = db() self.run() except socket.error, msg: print 'Failed to create socket. Error Code : ' + str( msg[0]) + ' Message ' + msg[1] sys.exit()
return ' '.join([traffic_details[0],traffic_details[1]]) # Handling requests on property ads @app.route('/process_request',methods=['POST']) def process_request(): data = request.form db.insert('request',username=session['username'],pid=data['pid'],visit=data['visit'],message=data['message']) user = db.query('users',username=session['username']) user_email= user[0]["email"] user_phone= user[0]["phone"] user_firstname=user[0]["firstname"] user_lastname=user[0]["lastname"] owner=db.query('properties', pid=data['pid']) owner_username= owner[0]["username"] owner_details=db.query('users',username=owner_username) msg="New Message: "+ data['message']+"from user:"******" "+user_lastname+" with number "+ user_phone +"and preference to site visit as: "+ data['visit'] send_msg=Message(msg,sender=user_email, recipients=[owner_details[0]["email"]]) mail.send(send_msg) return redirect(url_for('listings')) # Handling logging out @app.route('/logout') def logout(): session.pop('username', None) return redirect(url_for('home_page')) if __name__ == '__main__': db = db_utils.db(database="forsale", user="******", password="******", host="localhost") ph = PasswordHasher() app.run()
print(over) return render_template('home_page.html', quiz=quiz, over=over) @app.route('/take_quiz.html') def take_quiz(): return render_template('take_quiz.html') # Handling logging out @app.route('/logout.html') def logout(): session.pop('username', None) return redirect(url_for('login')) @app.route('/') @app.route('/login1.html', methods=['GET', 'POST']) def login(): return render_template('login1.html') if __name__ == '__main__': db = db_utils.db(database="quizon", user="******", password="******", host="localhost") ph = PasswordHasher() app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT' app.run()
res = [] for i in quiz: res.append(i['result']) over = numpy.mean(res) print(over) return render_template('home_page.html', quiz=quiz, over=over) @app.route('/take_quiz.html') def take_quiz(): return render_template('take_quiz.html') # Handling logging out @app.route('/logout.html') def logout(): session.pop('username', None) return redirect(url_for('login')) if __name__ == '__main__': db = db_utils.db(database="quizon", user="******", password="******", host="localhost") ph = PasswordHasher() app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT' app.run()
return ' '.join([traffic_details[0],traffic_details[1]]) # Handling requests on property ads @app.route('/process_request',methods=['POST']) def process_request(): data = request.form db.insert('request',username=session['username'],pid=data['pid'],visit=data['visit'],message=data['message']) user = db.query('users',username=session['username']) user_email= user[0]["email"] user_phone= user[0]["phone"] user_firstname=user[0]["firstname"] user_lastname=user[0]["lastname"] owner=db.query('properties', pid=data['pid']) owner_username= owner[0]["username"] owner_details=db.query('users',username=owner_username) msg="New Message: "+ data['message']+"from user:"******" "+user_lastname+" with number "+ user_phone +"and preference to site visit as: "+ data['visit'] send_msg=Message(msg,sender=user_email, recipients=[owner_details[0]["email"]]) mail.send(send_msg) return redirect(url_for('listings')) # Handling logging out @app.route('/logout') def logout(): session.pop('username', None) return redirect(url_for('home_page')) if __name__ == '__main__': db = db_utils.db(database="forsale", user="******", password="", host="localhost") ph = PasswordHasher() app.run()
def handler(event, context): print("Hello from Lambda 1!") return db()