class GoogleTrend(Myredis, Gtrend, MyKafka): def __init__(self): self.redis = Myredis() self.gtrend = Gtrend() self.kafka = MyKafka('NOTHS-trends-topic') def start(self): while True: time.sleep(randint(60, 90)) print('starting google trend ...') category = self.redis.getNextCategory() if category: print('reporting on :', category) gdata = self.gtrend.get_report(category) cdata = self.pack_gdata(gdata, category.decode("utf-8")) for data in cdata: list_ = ",".join(data) self.kafka.send(list_) print('end')
class GoogleTrend(Myredis, Gtrend, MyKafka): def __init__(self): self.redis = Myredis() self.gtrend = Gtrend() self.kafka = MyKafka("NOTHS-trends-topic") def start(self): while True: time.sleep(randint(60, 90)) print("starting google trend ...") category = self.redis.getNextCategory() if category: print("reporting on :", category) gdata = self.gtrend.get_report(category) cdata = self.pack_gdata(gdata, category.decode("utf-8")) for data in cdata: list_ = ",".join(data) self.kafka.send(list_) print("end")
def __init__(self): self.redis = Myredis() self.gtrend = Gtrend() self.kafka = MyKafka('NOTHS-trends-topic')
def __init__(self): self.redis = Myredis() self.gtrend = Gtrend() self.kafka = MyKafka("NOTHS-trends-topic")