Formatting.
This commit is contained in:
parent
cd9c3b6e39
commit
a79fc533ee
11 changed files with 231 additions and 204 deletions
|
|
@ -1,25 +1,27 @@
|
|||
import uuid
|
||||
from core.mysql_wrapper import get_tasksdb
|
||||
|
||||
class CapturingTasksInterface:
|
||||
|
||||
class CapturingTasksInterface:
|
||||
def __init__(self):
|
||||
|
||||
self.tasksdb = get_tasksdb()
|
||||
|
||||
def create_capturing_task(self, referencia, uuid_exploring=None):
|
||||
ads_root = 'https://www.idealista.com/inmueble/'
|
||||
ads_root = "https://www.idealista.com/inmueble/"
|
||||
|
||||
query_parameters = {'ad_url': ads_root + referencia,
|
||||
'uuid': str(uuid.uuid4()),
|
||||
'status': 'Pending'}
|
||||
query_parameters = {
|
||||
"ad_url": ads_root + referencia,
|
||||
"uuid": str(uuid.uuid4()),
|
||||
"status": "Pending",
|
||||
}
|
||||
|
||||
if uuid_exploring is None:
|
||||
query_statement = """INSERT INTO capturing_tasks_logs
|
||||
(uuid, write_time, status, ad_url)
|
||||
VALUES (%(uuid)s, NOW(), %(status)s, %(ad_url)s)"""
|
||||
else:
|
||||
query_parameters['uuid_exploring'] = uuid_exploring
|
||||
query_parameters["uuid_exploring"] = uuid_exploring
|
||||
query_statement = """INSERT INTO capturing_tasks_logs
|
||||
(uuid, write_time, status, ad_url, fk_uuid_exploring)
|
||||
VALUES (%(uuid)s, NOW(), %(status)s, %(ad_url)s, %(uuid_exploring)s)"""
|
||||
|
|
@ -43,16 +45,14 @@ class CapturingTasksInterface:
|
|||
return None
|
||||
|
||||
def update_capturing_task(self, uuid, uuid_exploring, status, ad_url):
|
||||
query_parameters = {'ad_url': ad_url,
|
||||
'uuid': uuid,
|
||||
'status': status}
|
||||
query_parameters = {"ad_url": ad_url, "uuid": uuid, "status": status}
|
||||
|
||||
if uuid_exploring is None:
|
||||
query_statement = """INSERT INTO capturing_tasks_logs
|
||||
(uuid, write_time, status, ad_url)
|
||||
VALUES (%(uuid)s, NOW(), %(status)s, %(ad_url)s)"""
|
||||
else:
|
||||
query_parameters['uuid_exploring'] = uuid_exploring
|
||||
query_parameters["uuid_exploring"] = uuid_exploring
|
||||
query_statement = """INSERT INTO capturing_tasks_logs
|
||||
(uuid, write_time, status, ad_url, fk_uuid_exploring)
|
||||
VALUES (%(uuid)s, NOW(), %(status)s, %(ad_url)s, %(uuid_exploring)s)"""
|
||||
|
|
@ -74,4 +74,5 @@ class CapturingTasksInterface:
|
|||
except:
|
||||
return 999
|
||||
|
||||
|
||||
capturing_interface = CapturingTasksInterface()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue