Exemplo n.º 1
0
        conn = mysql.connect(host='127.0.0.1',
                             database='MediaPlatformsReports',
                             user='******',
                             password='',
                             autocommit=True)
        return conn
    except Exception as e:
        print("ERROR: NO SE PUEDO ESTABLECER CONEXION MYSQL.")


if __name__ == '__main__':
    conn = openConnection()
    # Facebook
    try:

        dfcampanas = medios.Spreadsheet(db.FBA['key'], db.FBA['media'],
                                        db.FBA['campanas'])

        #medios.cuentas(dfcampanas, db.FBA['media'], conn)
        #medios.campanas(dfcampanas, db.FBA['media'], conn)
        #medios.metricas_campanas(dfcampanas, db.FBA['media'], conn)

    except Exception as e:
        print(e)
    # GOSogle
    try:
        dfcampanas = medios.Spreadsheet(db.GOA['key'], db.GOA['media'],
                                        db.GOA['campanas'])

        #medios.cuentas(dfcampanas, db.GOA['media'], conn)
        #medios.campanas(dfcampanas, db.GOA['media'], conn)
        #medios.metricas_campanas(dfcampanas, db.GOA['media'], conn)
Exemplo n.º 2
0
import config.db as db
import dbconnect as sql
import datos_fbgotw as medios

if __name__ == '__main__':

    # Iniciamos la conexion
    conn = sql.connect.open(db.DB['host'], db.DB['user'], db.DB['password'],
                            db.DB['dbname'], db.DB['port'],
                            db.DB['autocommit'])

    # Facebook
    try:
        dfcampanas = medios.Spreadsheet(db.FB['key'], db.FB['media'],
                                        db.FB['campanas'])
        dfadsets = medios.Spreadsheet(db.FB['key'], db.FB['media'],
                                      db.FB['adsets'])
        dfads = medios.Spreadsheet(db.FB['key'], db.FB['media'], db.FB['ads'])

        medios.cuentas(dfcampanas, db.FB['media'], conn)
        medios.campanas(dfcampanas, db.FB['media'], conn)
        medios.metricas_campanas(dfcampanas, db.FB['media'], conn)
        medios.adsets(dfadsets, db.FB['media'], conn)
    except Exception as e:
        print(e)

        # MediaMath

    # Google
    try:
        dfcampanas = medios.Spreadsheet(db.GO['key'], db.GO['media'],
Exemplo n.º 3
0
import datos_mediamath as mm
import datos_adform as adf
import datos_mediosextras as mediosextras
import datos_adsmovil as am
import psycopg2
if __name__ == '__main__':

    # Iniciamos la conexion
    conn = conn = psycopg2.connect(
        host='visor-rds.cebdvwvqle9k.us-west-1.rds.amazonaws.com',
        database='MediaPlatformsReports',
        user='******',
        password='******')
    # Facebook
    try:
        dfcampanas = medios.Spreadsheet(db.FB['key'], db.FB['media'],
                                        db.FB['campanas'])
        dfadsets = medios.Spreadsheet(db.FB['key'], db.FB['media'],
                                      db.FB['adsets'])
        dfads = medios.Spreadsheet(db.FB['key'], db.FB['media'], db.FB['ads'])

        #medios.metricas_campanas(dfcampanas, db.FB['media'], conn)
        #medios.metricas_adsets(dfadsets, db.FB['media'], conn)

        dfdiarios = medios.Spreadsheet(db.DAY['key'], 'FB', db.DAY['FB'])
        #medios.actualizarestado(dfdiarios, 'FB', conn)
        medios.diario_campanas(dfdiarios, 'FB', conn)

    except Exception as e:
        print(e)
    # Google
Exemplo n.º 4
0
    try:
        conn = mysql.connect(host='3.95.117.169',
                             database='MediaPlatformsReports',
                             user='******',
                             password='******',
                             autocommit=True)
        return conn
    except:
        print("ERROR: NO SE PUEDO ESTABLECER CONEXION MYSQL.")


if __name__ == '__main__':
    conn = openConnection()
    # Facebook
    try:
        dfcampanas = medios.Spreadsheet(db.FBM['key'], db.FBM['media'],
                                        db.FBM['campanas'])

        medios.cuentas(dfcampanas, db.FBS['media'], conn)
        medios.campanas(dfcampanas, db.FBS['media'], conn)
        medios.metricas_campanas(dfcampanas, db.FBS['media'], conn)

    except Exception as e:
        print(e)
    # GOSogle
    try:
        dfcampanas = medios.Spreadsheet(db.GOM['key'], db.GOM['media'],
                                        db.GOM['campanas'])

        medios.cuentas(dfcampanas, db.GOS['media'], conn)
        medios.campanas(dfcampanas, db.GOS['media'], conn)
        medios.metricas_campanas(dfcampanas, db.GOS['media'], conn)
Exemplo n.º 5
0
def openConnection():
    try:
        conn = psycopg2.connect(
            host='visor-rds.cebdvwvqle9k.us-west-1.rds.amazonaws.com',
            database='MediaPlatformsReports',
            user='******',
            password='******')
        #conn = mysql.connect(host='3.95.117.169', database='MediaPlatformsReports',user='******', password='******', autocommit=True)
        return conn
    except Exception as e:
        print("ERROR: NO SE PUEDO ESTABLECER CONEXION MYSQL.")


if __name__ == '__main__':
    conn = openConnection()
    # Facebook
    try:
        dfcampanas = medios.Spreadsheet(db.FBS['key'], db.FBS['media'],
                                        db.FBS['campanas'])

        #medios.cuentas(dfcampanas, db.FBS['media'], conn)
        #medios.campanas(dfcampanas, db.FBS['media'], conn)
        medios.metricas_campanas(dfcampanas, db.FBS['media'], conn)

    except Exception as e:
        print(e)

    # Cerramos la conexion
    conn.close()
    print('Database connection closed.')
Exemplo n.º 6
0
import config.db as db
import dbconnect as sql
import datos_fbgotw as medios
import datos_mediamath as mm
import datos_adform as adf
import datos_mediosextras as mediosextras
import datos_adsmovil as am

if __name__ == '__main__':

    # Iniciamos la conexion
    conn = sql.connect.open(db.DB['host'], db.DB['user'], db.DB['password'],
                            db.DB['dbname'], db.DB['autocommit'])
    # Facebook
    try:
        dfcampanas = medios.Spreadsheet(db.FB['key'], db.FB['media'],
                                        db.FB['campanas'])
        dfadsets = medios.Spreadsheet(db.FB['key'], db.FB['media'],
                                      db.FB['adsets'])
        dfads = medios.Spreadsheet(db.FB['key'], db.FB['media'], db.FB['ads'])

        dfdiarios = medios.Spreadsheet(db.DAY['key'], 'FB', db.DAY['FB'])
        medios.actualizarestado(dfdiarios, 'FB', conn)
        medios.diario_campanas(dfdiarios, 'FB', conn)

        dextras = medios.Spreadsheet(db.EXTRA['key'], 'FB', 0)
        medios.extrametrics(dextras, 'FB', conn)

        dactions = medios.Spreadsheet(db.EXTRA['key'], 'FB', db.EXTRA['CONV'])
        medios.actions(dactions, 'FB', conn)

    except Exception as e:
Exemplo n.º 7
0
def openConnection():
    try:
        conn = mysql.connect(host='3.95.117.169', database='MediaPlatforms',
                             user='******', password='******', autocommit=True)
        return conn
    except:
        print("ERROR: NO SE PUEDO ESTABLECER CONEXION MYSQL.")
        sys.exit()


if __name__ == '__main__':
    conn = openConnection()
    # Facebook
    try:
        dfcampanas = medios.Spreadsheet(
            DB.FB['key'], DB.FB['media'], DB.FB['campanas'])
        dfadsets = medios.Spreadsheet(
            DB.FB['key'], DB.FB['media'], DB.FB['adsets'])
        dfads = medios.Spreadsheet(
            DB.FB['key'], DB.FB['media'], DB.FB['ads'])

        medios.cuentas(dfcampanas, DB.FB['media'], conn)
        medios.campanas(dfcampanas, DB.FB['media'], conn)
        medios.adsets(dfadsets, DB.FB['media'], conn)
        medios.ads(dfads, DB.FB['media'], conn)
        medios.creative_ads(dfads, DB.FB['media'], conn)
    except Exception as e:
        print('Error on line {}'.format(
            sys.exc_info()[-1].tb_lineno), type(e).__name__, e)

        # MediaMath
Exemplo n.º 8
0
def openConnection():
    try:
        conn = mysql.connect(host='3.95.117.169', database='MediaPlatforms',
                             user='******', password='******', autocommit=True)
        return conn
    except:
        print("ERROR: NO SE PUEDO ESTABLECER CONEXION MYSQL.")


if __name__ == '__main__':
    conn = openConnection()
    # Facebook
    # Facebook
    try:
        dfdiarios = medios.Spreadsheet(
            DB.FB['key'], DB.FB['media'], DB.DAY['FB'])

        medios.diario_campanas(dfdiarios, 'FB', conn)

        dextras = medios.Spreadsheet(DB.EXTRA['key'], 'FB', 0)
        medios.extrametrics(dextras, 'FB', conn)

        dactions = medios.Spreadsheet(
            DB.EXTRA['key'], 'FB', DB.EXTRA['CONV'])
        medios.actions(dactions, 'FB', conn)

    except Exception as e:
        print('Error on line {}'.format(
            sys.exc_info()[-1].tb_lineno), type(e).__name__, e)
    # Google
    try:
Exemplo n.º 9
0
    try:
        conn = mysql.connect(host='3.95.117.169',
                             database='MediaPlatformsReports',
                             user='******',
                             password='******',
                             autocommit=True)
        return conn
    except Exception as e:
        print("ERROR: NO SE PUEDO ESTABLECER CONEXION MYSQL.")


if __name__ == '__main__':
    conn = openConnection()
    # Facebook
    try:
        dfcampanas = medios.Spreadsheet(db.FBP['key'], db.FBP['media'],
                                        db.FBP['campanas'])

        #medios.cuentas(dfcampanas, db.FBS['media'], conn)
        #medios.campanas(dfcampanas, db.FBS['media'], conn)
        medios.metricas_campanas_temp(dfcampanas, db.FBP['media'], conn)

    except Exception as e:
        print(e)
    # GOSogle
    try:
        dfcampanas = medios.Spreadsheet(db.GOP['key'], db.GOP['media'],
                                        db.GOP['campanas'])

        #medios.cuentas(dfcampanas, db.GOS['media'], conn)
        #medios.campanas(dfcampanas, db.GOS['media'], conn)
        medios.metricas_campanas_temp(dfcampanas, db.GOP['media'], conn)