Cambios notables. Creadas interfaces para la tabla de capturing task
y la tabla de capturas. Traslado todo lo relacionado a Geocoding a un servicio independiente del capturer. Replanteo totalmente el parseo del html, creando un objeto nuevo.
This commit is contained in:
parent
3bd8de0e02
commit
240a61649c
7 changed files with 474 additions and 262 deletions
|
|
@ -1,5 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import mysql.connector
|
||||
from core.alerts import alert_master
|
||||
|
||||
anuncios_db_parameters = {'host': '185.166.215.170',
|
||||
'database': 'anuncios',
|
||||
|
|
@ -37,13 +38,21 @@ class DatabaseWrapper():
|
|||
self.connect()
|
||||
self.disconnect()
|
||||
|
||||
def query(self, query_statement, query_parameters = None, dictionary = False):
|
||||
def query(self, query_statement, query_parameters=None, dictionary=False):
|
||||
self.connect()
|
||||
if self.connection.is_connected():
|
||||
execution_cursor = self.connection.cursor(dictionary = dictionary)
|
||||
execution_cursor.execute(query_statement, query_parameters)
|
||||
self.disconnect()
|
||||
return execution_cursor
|
||||
try:
|
||||
execution_cursor = self.connection.cursor(dictionary = dictionary)
|
||||
execution_cursor.execute(query_statement, query_parameters)
|
||||
self.disconnect()
|
||||
return execution_cursor
|
||||
except:
|
||||
alert_master("SQL ERROR", """Se ha producido un error ejecutando la
|
||||
siguiente query: %s.
|
||||
Con los siguientes parametros: %s
|
||||
""".format(query_statement,
|
||||
query_parameters))
|
||||
|
||||
else:
|
||||
raise Exception("Could not connect to the database.")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue