forked from GTorrandella/PDI-TweetMaster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ScriptInsertsBD.py
137 lines (111 loc) · 7.49 KB
/
ScriptInsertsBD.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#Script para insertar Campaigns y Tweets de prueba:
import json
from Manager import manager
from DataBaseConnector import configTables
#Insercion de 10 Campaigns:
userCampaignInput1= '{"email":"activa@gmail.com","hashtags": ["#noBorrrar", "#412"], "mentions": ["@fedecalongeOK", "@mauriciomacriOKkk"], "startDate":"16 12 2018 18:22:00", "endDate":"10 01 2019 18:22:00"}'
campaignFields1 = json.loads(userCampaignInput1) #Pasa de json a diccionario, esto lo hace flask por eso no hace falta hacerlo en el insertCampaign() del manager.
manager.Manager().insertCampaign(campaignFields1)
userCampaignInput2= '{"email":"activaConTw@gmail.com","hashtags": ["#tieneTw", "#noBorrarNada", "#412"], "mentions": ["@fedecalongeOK", "@mauriciomacriOKkk"], "startDate":"22 12 2018 18:22:00", "endDate":"10 01 2019 18:22:00"}'
campaignFields2 = json.loads(userCampaignInput2) #Pasa de json a diccionario, esto lo hace flask por eso no hace falta hacerlo en el insertCampaign() del manager.
manager.Manager().insertCampaign(campaignFields2)
userCampaignInput3= '{"email":"finalizadaConTw@gmail.com","hashtags": ["#tieneTw", "#borrarTodo", "#200"], "mentions": ["@fedecalongeOK", "@mauriciomacriOKkk"], "startDate":"16 12 2018 18:22:00", "endDate":"28 12 2018 18:22:00"}'
campaignFields3 = json.loads(userCampaignInput3) #Pasa de json a diccionario, esto lo hace flask por eso no hace falta hacerlo en el insertCampaign() del manager.
manager.Manager().insertCampaign(campaignFields3)
userCampaignInput4= '{"email":"noEmpezada@gmail.com","hashtags": ["#borrar", "#200"], "mentions": ["@fedecalongeOK", "@mauriciomacriOKkk"], "startDate":"10 01 2019 18:22:00", "endDate":"20 01 2019 18:22:00"}'
campaignFields4 = json.loads(userCampaignInput4) #Pasa de json a diccionario, esto lo hace flask por eso no hace falta hacerlo en el insertCampaign() del manager.
manager.Manager().insertCampaign(campaignFields4)
userCampaignInput5= '{"email":"finalizada@gmail.com","hashtags": ["#borrar", "#200"], "mentions": ["@fedecalongeOK", "@mauriciomacriOKkk"], "startDate":"24 12 2018 18:22:00", "endDate":"25 12 2018 18:22:00"}'
campaignFields5 = json.loads(userCampaignInput5) #Pasa de json a diccionario, esto lo hace flask por eso no hace falta hacerlo en el insertCampaign() del manager.
manager.Manager().insertCampaign(campaignFields5)
userCampaignInput6= '{"email":"noEmpezadaConTw@gmail.com","hashtags": ["#tieneTw", "#borrarTodo", "#200"], "mentions": ["@fedecalongeOK", "@mauriciomacriOKkk"], "startDate":"10 01 2019 18:22:00", "endDate":"20 01 2019 18:22:00"}'
campaignFields6 = json.loads(userCampaignInput6) #Pasa de json a diccionario, esto lo hace flask por eso no hace falta hacerlo en el insertCampaign() del manager.
manager.Manager().insertCampaign(campaignFields6)
userCampaignInput7= '{"email":"activaConTw@gmail.com","hashtags": ["#tieneTw", "#noBorrarNada", "#412"], "mentions": ["@fedecalongeOK", "@mauriciomacriOKkk"], "startDate":"22 12 2018 18:22:00", "endDate":"10 01 2019 18:22:00"}'
campaignFields7 = json.loads(userCampaignInput7) #Pasa de json a diccionario, esto lo hace flask por eso no hace falta hacerlo en el insertCampaign() del manager.
manager.Manager().insertCampaign(campaignFields7)
userCampaignInput8= '{"email":"finalizadaConTw@gmail.com","hashtags": ["#tieneTw", "#borrarTodo", "#200"], "mentions": ["@fedecalongeOK", "@mauriciomacriOKkk"], "startDate":"16 12 2018 18:22:00", "endDate":"28 12 2018 18:22:00"}'
campaignFields8 = json.loads(userCampaignInput8) #Pasa de json a diccionario, esto lo hace flask por eso no hace falta hacerlo en el insertCampaign() del manager.
manager.Manager().insertCampaign(campaignFields8)
userCampaignInput9= '{"email":"mezclada@gmail.com","hashtags": ["#borrar", "#200"], "mentions": ["@fedecalongeOK", "@mauriciomacriOKkk"], "startDate":"24 12 2018 18:22:00", "endDate":"25 12 2018 18:22:00"}'
campaignFields9 = json.loads(userCampaignInput9) #Pasa de json a diccionario, esto lo hace flask por eso no hace falta hacerlo en el insertCampaign() del manager.
manager.Manager().insertCampaign(campaignFields9)
userCampaignInput10= '{"email":"mezclada@gmail.com","hashtags": ["#noBorrrar", "#412"], "mentions": ["@fedecalongeOK", "@mauriciomacriOKkk"], "startDate":"16 12 2018 18:22:00", "endDate":"10 01 2019 18:22:00"}'
campaignFields10 = json.loads(userCampaignInput10) #Pasa de json a diccionario, esto lo hace flask por eso no hace falta hacerlo en el insertCampaign() del manager.
manager.Manager().insertCampaign(campaignFields10)
#Insercion de 10 Tweets:
#Inserción de Tweets en campaña 4:
tweet1 = {
"id_str" : "223",
"user" : {"name" : "NASAOk", "id_str" : "789456"},
"entities" : {"hashtags" : ["#mars","#venus","#earth"],"user_mentions" : ["@NASA", "@planets"]},
"created_at" : "Sun Mar 20 15:11:01 +0000 2018"
}
tweet2 = {
"id_str" : "224",
"user" : {"name" : "MiauricioOK", "id_str" : "451325"},
"entities" : {"hashtags" : ["#DonaldNoMeDejes"],"user_mentions" : ["@donaldTrump", "@G20"]},
"created_at" : "Sun Mar 20 21:08:01 +0000 2018"
}
tweetsJson = [json.dumps(tweet1),json.dumps(tweet2)]
manager.Manager().insertTweets(tweetsJson, 4)
#Inserción de Tweets en campaña 5:
tweet3 = {
"id_str" : "323",
"user" : {"name" : "NASAOk", "id_str" : "789456"},
"entities" : {"hashtags" : ["#mars", "#venus", "#earth"],"user_mentions" : ["@NASA", "@planets"]},
"created_at" : "Sun Mar 20 15:11:01 +0000 2018"
}
tweet4 = {
"id_str" : "324",
"user" : {"name" : "MiauricioOK", "id_str" : "451325"},
"entities" : {"hashtags" : ["#DonaldNoMeDejes"],"user_mentions" : ["@donaldTrump", "@G20"]},
"created_at" : "Sun Mar 20 21:08:01 +0000 2018"
}
tweetsJson = [json.dumps(tweet3),json.dumps(tweet4)]
manager.Manager().insertTweets(tweetsJson, 5)
#INserción de Tweets en campaña 8:
tweet5 = {
"id_str" : "623",
"user" : {"name" : "NASAOk", "id_str" : "789456"},
"entities" : {"hashtags" : ["#mars", "#venus", "#earth"],"user_mentions" : ["@NASA", "@planets"]},
"created_at" : "Sun Mar 20 21:08:01 +0000 2018"
}
tweet6 = {
"id_str" : "624",
"user" : {"name" : "MiauricioOK", "id_str" : "451325"},
"entities" : {"hashtags" : ["#DonaldNoMeDejes"],"user_mentions" : ["@donaldTrump", "@G20"]},
"created_at" : "Sun Mar 20 21:08:01 +0000 2018"
}
tweetsJson = [json.dumps(tweet5),json.dumps(tweet6)]
manager.Manager().insertTweets(tweetsJson, 8)
#Inserción de Tweets en campaña 9:
tweet7 = {
"id_str" : "724",
"user" : {"name" : "MiauricioOK", "id_str" : "451325"},
"entities" : {"hashtags" : ["#DonaldNoMeDejes"],"user_mentions" : ["@donaldTrump", "@G20"]},
"created_at" : "Sun Mar 20 21:08:01 +0000 2018"
}
tweet8 = {
"id_str" : "732",
"user" : {"name" : "MiauricioOK", "id_str" : "451325"},
"entities" : {"hashtags" : ["#mars", "#venus", "#earth"],"user_mentions" : ["@NASA", "@planets"]},
"created_at" : "Sun Mar 20 21:08:01 +0000 2018"
}
tweetsJson = [json.dumps(tweet7),json.dumps(tweet8)]
manager.Manager().insertTweets(tweetsJson, 9)
#INserción de Tweets en campaña 10:
tweet9 = {
"id_str" : "845",
"user" : {"name" : "NASAOk", "id_str" : "451325"},
"entities" : {"hashtags" : ["#DonaldNoMeDejes"],"user_mentions" : ["@donaldTrump", "@G20"]},
"created_at" : "Sun Mar 20 21:08:01 +0000 2018"
}
tweet10 = {
"id_str" : "895",
"user" : {"name" : "MiauricioOK", "id_str" : "789456"},
"entities" : {"hashtags" : ["#mars", "#venus", "#earth"],"user_mentions" : ["@NASA", "@planets"]},
"created_at" : "Sun Mar 20 21:08:01 +0000 2018"
}
tweetsJson = [json.dumps(tweet9),json.dumps(tweet10)]
manager.Manager().insertTweets(tweetsJson, 10)