-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathta_RecuperaRetweets.py
77 lines (50 loc) · 1.96 KB
/
ta_RecuperaRetweets.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 7 10:26:15 2017
@author: Luis Carlos Prieto
"""
import log
import ta_MongoDB
import ta_SQLServer
import ta_DataCleaner
#import ta_twitter
def main():
# Variables Generales...
Errores = 0
miLog = log.Log()
GestorMongoDB = ta_MongoDB.MongoDB
GestorSQLServer = ta_SQLServer.SQLServer
#GestorTwitter = ta_twitter.Twitter
miLog.Salidaln("Bienvenido al Manager de carga RETWEETS de MBIT, Iniciando servicios...")
GestorMongoDB = ta_MongoDB.MongoDB()
#GestorTwitter = ta_twitter.Twitter(GestorMongoDB.m_db)
#GestorTwitter.BuscarNuevos()
try:
# Creación del -Gestor de SQL Server
GestorSQLServer = ta_SQLServer.SQLServer()
except Exception as e:
Errores += 1
miLog.Salidaln("ERROR generando Gestor de SQL Server..." )
miLog.Salidaln(e.args)
return -1
try:
#Una vez aseguradas las conexiones a BBDD, cargamos los Tweets en formato JSON
GestorMongoDB.CargarJSON()
# Creación del DataCleaner y Volcados a SQL Server
DataCleaner = ta_DataCleaner.DataCleaner(GestorMongoDB.m_ListaJSON)
miLog.Salidaln("Volcando Annálisis a SQL Server..." )
DataCleaner.AnalisisTweetsRetweet()
GestorSQLServer.ParcialTimeline(DataCleaner.m_ListaTimeline)
# Marcamos los tweets ya cargados para reducir la carga de parciales desde Mongo Azure
#GestorMongoDB.CerrarJSONParcial(DataCleaner.m_ListaTimeline)
GestorSQLServer.m_conSQL.close()
except Exception as e:
Errores += 1
miLog.Salidaln("ERROR No se ha podido generar DataCleaner ")
miLog.Salidaln(e.args)
if (Errores > 0 ):
miLog.Salidaln("ERRORES DETECTADOS")
else:
miLog.Salidaln("Proceso finalizado con exito...")
main()