-
Notifications
You must be signed in to change notification settings - Fork 0
/
PrintSinaFQAction.py
31 lines (28 loc) · 1.01 KB
/
PrintSinaFQAction.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
# -*- coding: utf-8 -*-
from Action import Action
import util
import re
from datetime import datetime
import threading
class PrintSinaFQAction(Action):
def __init__(self, **kwargs):
Action.__init__(self, **kwargs )
self._producer_list = [
{
"name" : "SinaFreeQuote",
"producer_name" : "PrintSinaFQ.SinaFreeQuote-quotation"
}]
self._init()
self.logger.info(self._name +u"初始化")
self.count = 0
# 需要重写的方法
def handler(self, event):
dt = datetime.now()
if isinstance(event.data, list):
for data in event.data:
self.count += 1
print("PrintSinaFQ:{}, \nCount:{}, Length: {}\n{}".format( dt,self.count, len(data),data ) )
else:
self.count += 1
print("PrintSinaFQ:{}, \nCount:{}, Length: {}\n{}".format( dt,self.count, len(event.data),event.data ) )
# self.logger.info("线程退出")