username_integer by parameter

This commit is contained in:
Your Name
2024-09-11 11:56:43 -06:00
parent d3e3cd464e
commit 8f807c1bd9

8
app.py
View File

@@ -49,7 +49,7 @@ service = Service('/usr/bin/chromedriver')
driver = None
def insert_alumno_extraccion(datos_html: str, materias_html: str, historial_html: str = 'error', materias_actuales_html: str = 'error'):
def insert_alumno_extraccion(datos_html: str, materias_html: str, username_integer: int, historial_html: str = 'error', materias_actuales_html: str = 'error'):
conn = get_db_connection() # Obtener una conexión del pool
try:
cur = conn.cursor()
@@ -78,7 +78,7 @@ def insert_alumno_extraccion(datos_html: str, materias_html: str, historial_html
cur.close()
release_db_connection(conn) # Liberar la conexión
def update_alumno_extraccion_error(error: str):
def update_alumno_extraccion_error(username_integer: int, error: str):
conn = get_db_connection() # Obtener una conexión del pool
try:
cur = conn.cursor()
@@ -162,12 +162,12 @@ def extract(driver, username: str, password: str):
json_result = df[df['GRUPO'] != 'Promedio:'].to_json(orient='records')
query = insert_alumno_extraccion(datos_html, materias_html, json_result)
query = insert_alumno_extraccion(datos_html, materias_html, username_integer, json_result)
print("Data extracted successfully")
return json_result
except NoSuchElementException as e:
update_alumno_extraccion_error(str(e))
update_alumno_extraccion_error(username_integer, str(e))
app = Flask(__name__)