28 lines
615 B
Python
28 lines
615 B
Python
|
|
from core.mysql_wrapper import get_anunciosdb
|
||
|
|
|
||
|
|
|
||
|
|
class CapturasInterface():
|
||
|
|
|
||
|
|
def __init__(self):
|
||
|
|
|
||
|
|
self.anunciosdb = get_anunciosdb()
|
||
|
|
|
||
|
|
def insert_captura(self, ad_data):
|
||
|
|
|
||
|
|
columns = ', '.join(ad_data.keys())
|
||
|
|
placeholders_string = ', '.join('%s' * len(ad_data))
|
||
|
|
|
||
|
|
query_statement = """ INSERT INTO capturas
|
||
|
|
(%s)
|
||
|
|
VALUES(%s)""".format(columns, placeholders_string)
|
||
|
|
|
||
|
|
query_parameters = ad_data.values()
|
||
|
|
|
||
|
|
self.anunciosdb.query(query_statement, query_parameters)
|
||
|
|
|
||
|
|
|
||
|
|
capturas_interface = CapturasInterface()
|
||
|
|
|
||
|
|
|
||
|
|
|