def addedbook(): nData = DbClass().adddata() nAuteur = DbClass().addauteur() GPIO.output(led, GPIO.HIGH) GPIO.output(buz, GPIO.HIGH) time.sleep(1) GPIO.output(led, GPIO.LOW) GPIO.output(buz, GPIO.LOW) return render_template('index.html', nData=nData)
from flask import Flask, render_template, request, jsonify import nltk import random import string from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import cosine_similarity import dbclass from dbclass import DbClass import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText app = Flask(__name__) DbClass = DbClass() GREETING_INPUTS = ["hello", "hi", "greetings", "sup", "hey", "hey", "hai"] GREETING_RESPONSES = [ "hi", "hey", "hi there", "hello", "I am glad! You are talking to me" ] APPROVAL = ['yes', 'yeah', 'ok', 'okay'] PHYSICIANS = [ 'Paediatrician', 'Gynaecologist', 'Surgeon', 'Psychiatrist', 'Cardiologist', 'Dermatologist', 'Endocrinologist', 'Gastroenterologist', 'Nephrologist', 'Ophthalmologist', 'Otolaryngologist', 'ENT', 'Pulmonologist', 'Neurologist', 'Radiologist', 'Anaesthesiologist', 'Oncologist' ] flag = False p = False cur_physician = "" name = "" f = open('physicians.txt', 'r', errors='ignore')
from ledclass import LEDclass from dbclass import DbClass import time import datetime import sys print(sys.executable) import os print(os.getcwd()) print(sys.path) time.sleep(15) leds = LEDclass(13, 19, 26) data = DbClass() input = MCP3008(0, 0) why = input.readLight() left = input.readLeftButton() right = input.readRightButton() print(why, left, right) def datetimefromtime(timer): uren = int(timer[0:2]) minuten = int(timer[3:5]) result = datetime.datetime(datetime.datetime.now().year, datetime.datetime.now().month, datetime.datetime.now().day, uren, minuten, 0) return result
import psycopg2 from dbclass import DbClass if __name__ == '__main__': try: db = DbClass(dbn="courses", log=True) # db.connect() # command = ( """ CREATE TABLE evaluations ( course_id INTEGER NOT NULL, student_id INTEGER NOT NULL, eval_date DATE, eval_course_mod CHAR(10), eval_course_date DATE, eval_domain CHAR(10), eval_present_duration CHAR(10), eval_facility CHAR(10), eval_clarity CHAR(10), eval_relationship CHAR(10), eval_usable CHAR(10), eval_handout CHAR(10), eval_applicable CHAR(10), eval_organiz CHAR(10), eval_local CHAR(10), eval_expectancy CHAR(10), eval_comments CHAR(10), eval_strong_points CHAR(150),
def rentedbooks(): rented = DbClass().getrented() return render_template('rentedbooks.html',rented =rented)
def allbooks(): data = DbClass().getdata() return render_template('allbooks.html',data=data)
import psycopg2 from dbclass import DbClass if __name__ == '__main__': try: # db = DbClass(dbn="Bakos", log=True) # db.connect() # ssss command = "SELECT oid, * FROM pg_catalog.pg_am" db.execute(command) # fetch = db.cur.fetchall() i = 1 for row in fetch: print("Row number ", i, "- ", row) i += 1 # db.close() # except (Exception, psycopg2.DatabaseError) as error: print("Db error = ", error)