username_integer by parameter
This commit is contained in:
8
app.py
8
app.py
@@ -49,7 +49,7 @@ service = Service('/usr/bin/chromedriver')
|
|||||||
|
|
||||||
driver = None
|
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
|
conn = get_db_connection() # Obtener una conexión del pool
|
||||||
try:
|
try:
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
@@ -78,7 +78,7 @@ def insert_alumno_extraccion(datos_html: str, materias_html: str, historial_html
|
|||||||
cur.close()
|
cur.close()
|
||||||
release_db_connection(conn) # Liberar la conexión
|
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
|
conn = get_db_connection() # Obtener una conexión del pool
|
||||||
try:
|
try:
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
@@ -162,12 +162,12 @@ def extract(driver, username: str, password: str):
|
|||||||
|
|
||||||
json_result = df[df['GRUPO'] != 'Promedio:'].to_json(orient='records')
|
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")
|
print("Data extracted successfully")
|
||||||
return json_result
|
return json_result
|
||||||
|
|
||||||
except NoSuchElementException as e:
|
except NoSuchElementException as e:
|
||||||
update_alumno_extraccion_error(str(e))
|
update_alumno_extraccion_error(username_integer, str(e))
|
||||||
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|||||||
Reference in New Issue
Block a user