From 618507a9cf8ec936ba5deee6fb3d4f00ce58dc87 Mon Sep 17 00:00:00 2001 From: Alejandro Lara Date: Tue, 10 Sep 2024 16:16:21 +0000 Subject: [PATCH 1/2] Actualizar app.py --- app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index c228c54..e024ab0 100644 --- a/app.py +++ b/app.py @@ -3,7 +3,7 @@ import psycopg2 from psycopg2 import pool # Crear un pool de conexiones global -connection_pool = psycopg2.pool.SimpleConnectionPool( +connection_pool = psycopg2.pool.ThreadedConnectionPool( minconn=1, maxconn=10, # Define el tamaño máximo del pool dbname=os.getenv("DBNAME"), From 7ef90ede59ea2839669369f0784c9870febc39ed Mon Sep 17 00:00:00 2001 From: Alejandro Lara Date: Tue, 10 Sep 2024 16:18:53 +0000 Subject: [PATCH 2/2] Cambio imports --- app.py | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/app.py b/app.py index e024ab0..3b1bde0 100644 --- a/app.py +++ b/app.py @@ -2,6 +2,22 @@ import psycopg2 from psycopg2 import pool +from selenium import webdriver +from selenium.webdriver.chrome.service import Service +from selenium.webdriver.common.by import By +from selenium.webdriver.common.keys import Keys +from selenium.webdriver.chrome.options import Options +from selenium.common.exceptions import NoSuchElementException +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC +from selenium.common.exceptions import StaleElementReferenceException + +import os +from flask import Flask, request, jsonify +from waitress import serve +import pandas as pd +from io import StringIO + # Crear un pool de conexiones global connection_pool = psycopg2.pool.ThreadedConnectionPool( minconn=1, @@ -22,24 +38,6 @@ def release_db_connection(conn): connection_pool.putconn(conn) -from selenium import webdriver -from selenium.webdriver.chrome.service import Service -from selenium.webdriver.common.by import By -from selenium.webdriver.common.keys import Keys -from selenium.webdriver.chrome.options import Options -from selenium.common.exceptions import NoSuchElementException -from selenium.webdriver.support.ui import WebDriverWait -from selenium.webdriver.support import expected_conditions as EC -from selenium.common.exceptions import StaleElementReferenceException - -import os -from flask import Flask, request, jsonify -from waitress import serve -import pandas as pd -from io import StringIO - - - # Set options for the Chromium browser chrome_options = Options() chrome_options.add_argument("--headless") # Optional: Run Chromium in headless mode