def filling_and_uploading(): # print("Имя:") # f_name = str(input()) # print("Фамилия:") # l_name = str(input()) print("Телефон:") tel_number = str(input()) aim = "test" con = db.sql_connection() data = db.sql_find_person(con, tel_number) id = data[0][0] first_name = data[0][1] last_name = data[0][2] pass_number = data[0][3] pass_info = data[0][4] reg_address = data[0][5] name = first_name + " " + last_name logging.basicConfig(filename='app.log', filemode='a', format='%(asctime)s - %(message)s', level=logging.INFO) logging.info('Send request to FILL IN docx template for ' + name) return [ consent_personal_data(first_name, last_name, pass_number, pass_info, reg_address, aim, "Шереметьево"), name, id ]
def grab_records(month='AUG'): ''' Pull the summer temperature data, @retval: List[SummerTemperature] ''' conn = db.sql_connection() cur = conn.cursor() #excluded = """('FL', 'GA', 'SC', 'AL', 'MS', 'TX', 'OK', 'AZ', 'CA', 'ND', 'SD', 'NE', 'MO', 'IA', 'KS', 'LA', 'AK', 'AR' )""" excluded = """('AK', 'HI')""" res = list(cur.execute(f"""SELECT latitude, longitude, elevation, state, name, {tmax_tbl}.{month}, {tmax_tbl}.id FROM {stations_tbl} JOIN {tmax_tbl} ON {tmax_tbl}.id=stations.id WHERE state NOT IN {excluded} AND latitude >25 AND latitude < 51 AND longitude > -140 AND longitude < -60""").fetchall()) return [SummerTemperature(*item) for item in res]
def gethanzi(id=0): r = db.get_data(db.sql_connection(), (id, )) a = {} for i in r: a["id"] = i[0] a["hanzi"] = i[1] a["type"] = i[2] a["learned"] = i[3] a["passed"] = i[4] return jsonify(a)
# FUNCTIONS def allowed_image(filename): if not "." in filename: return False ext = filename.rsplit(".", 1)[1] if ext.upper() in app.config["ALLOWED_IMAGE_EXTENSIONS"]: return True else: return False # connection to the db # I used this one! #https://likegeeks.com/python-sqlite3-tutorial/ sql_connection() # Make sure API key is set? # HOMEPAGE @app.route("/") @login_required def index(): #https://docs.python-guide.org/scenarios/imaging/ #https://flask.palletsprojects.com/en/1.1.x/patterns/fileuploads/ list_of_filenames = {} list_of_filenames = os.listdir(UPLOAD_FILES) print(list_of_filenames[1])
from db import sql_connection con = sql_connection() class Estudiante: def __init__(self, id, estudiantes, nombre, apellido, usuario, password, codigo): self.id = id self.estudiantes = estudiantes self.nombre = nombre self.apellido = apellido self.usuario = usuario self.password = password self.codigo = codigo def getId(self): return self.id def setId(self, id): self.id = id
def updatehanzi(data): d = (data["hanzi"], data["type"], data["learned"], data["passed"], data["id"]) r = db.update_data(db.sql_connection(), d) return r