-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
65 lines (52 loc) · 1.44 KB
/
main.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
#______________________________________________
#
# CIS 612 Lab Assignment 3
#
# Author:
#______________________________________________
#import libraries
import pymongo
from pymongo import MongoClient
import json
import tweepy
import twitter
from pprint import pprint
import configparser
import pandas as pd
import sys
#import scripts
import configparse
import StreamListener.py
import mongodb_util
import sql_util
#running the scripts
def run_scripts(configparse):
if __name__ == '__main__':
# executed script
print 'script successfully executed, proceeding to next'
run_scripts(StreamListener):
if __name__ == '__main__':
# executed as script
print 'script successfully executed, proceeding to next'
run_scripts(mongodb_util)
if __name__ == '__main__':
# executed as script
print 'script successfully executed, proceeding to next'
run_scripts(sql_util)
if __name__ == '__main__':
# executed as script
print 'script successfully executed, proceeding to next'
else
#on error
print "error in running scripts"
# run the scraping for one hour
from datetime import datetime
from threading import Timer
x=datetime.today()
y=x.replace(day=x.day+1, hour=1, minute=0, second=0, microsecond=0)
delta_t=y-x
secs=delta_t.seconds+1
def MyStreamListener()
t = Timer(secs, MyStreamListener)
t.start()
y = x.replace(day=x.day, hour=1, minute=0, second=0, microsecond=0) + timedelta(days=1)