File tree 1 file changed +12
-8
lines changed
1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -40,14 +40,18 @@ def __init__(self, mongo_col):
40
40
self .collection .remove ()
41
41
42
42
def on_data (self , raw_data ):
43
- data = json .loads (raw_data )
44
- if data .get ("lang" ) == 'en' :
45
- if data .get ("entities" ) and \
46
- data .get ("entities" ).get ('user_mentions' ) and \
47
- data ["entities" ]['user_mentions' ]:
48
- tweet = convert_tweet (data )
49
- # print tweet
50
- self .collection .insert (tweet )
43
+ try :
44
+ data = json .loads (raw_data )
45
+ if data .get ("lang" ) == 'en' :
46
+ if data .get ("entities" ) and \
47
+ data .get ("entities" ).get ('user_mentions' ) and \
48
+ data ["entities" ]['user_mentions' ]:
49
+ tweet = convert_tweet (data )
50
+ # print tweet
51
+ self .collection .insert (tweet )
52
+ except :
53
+ import traceback
54
+ traceback .print_exc (file = sys .stdout )
51
55
return True
52
56
53
57
def on_error (self , status ):
You can’t perform that action at this time.
0 commit comments