|
@@ -8,11 +8,7 @@ coding=utf-8
|
|
|
@contact: renyupeng@c-top.com.cn
|
|
|
@Tel 1501435553
|
|
|
"""
|
|
|
-import time
|
|
|
-from concurrent.futures.thread import ThreadPoolExecutor
|
|
|
-
|
|
|
from flask import Flask, request, json
|
|
|
-
|
|
|
from constant.ConfConstant import ConfConstant
|
|
|
from spider.PromoterFansInfo import PromoterFansInfo
|
|
|
from spider.PromoterInfoSpider import PromoterInfoSpider
|
|
@@ -22,6 +18,7 @@ from spider.PromoterVideoAnalysisTrend import PromoterVideoAnalysisTrend
|
|
|
from multiprocessing import Process
|
|
|
|
|
|
from spider.ReturnPromoterInfoSpider import ReturnPromoterInfoSpider
|
|
|
+from utils.mysql_utils import MysqlUtils
|
|
|
|
|
|
app = Flask(__name__)
|
|
|
|
|
@@ -34,22 +31,21 @@ def api_root():
|
|
|
def webhook_get_promoter():
|
|
|
rep = json.loads(request.data)
|
|
|
promoterId = rep["promoterId"]
|
|
|
- # pool = multiprocessing.Pool(4)
|
|
|
- # m = multiprocessing.Manager()
|
|
|
- print(time.time(), 'p0----')
|
|
|
- reuslt = ReturnPromoterInfoSpider().PromoterInfoSpiderHandler(promoterId)
|
|
|
- p1 = Process(target=PromoterInfoSpider().PromoterInfoSpiderHandler, args=(promoterId,))
|
|
|
- p2 = Process(target=PromoterFansInfo().PromoterFansInfoHandler, args=(promoterId,))
|
|
|
- p3 = Process(target=PromoterLiveInfoSpider().PromoterLiveInfoSpiderHander, args=(promoterId,))
|
|
|
- p4 = Process(target=PromoterVideoAnalysisInfo().PromoterVideoAnalysisInfoHandler, args=(promoterId,))
|
|
|
- p5 = Process(target=PromoterVideoAnalysisTrend().PromoterVideoAnalysisTrendHandler, args=(promoterId,))
|
|
|
+ sql = "select cookie from ruixuan.kuaishou_supply_chain_cookie"
|
|
|
+ cookie = MysqlUtils().QueryOne(sql)[0]
|
|
|
+ rollback = ReturnPromoterInfoSpider().PromoterInfoSpiderHandler(promoterId, cookie)
|
|
|
+ p1 = Process(target=PromoterInfoSpider().PromoterInfoSpiderHandler, args=(promoterId, cookie))
|
|
|
+ p2 = Process(target=PromoterFansInfo().PromoterFansInfoHandler, args=(promoterId, cookie))
|
|
|
+ p3 = Process(target=PromoterLiveInfoSpider().PromoterLiveInfoSpiderHander, args=(promoterId, cookie))
|
|
|
+ p4 = Process(target=PromoterVideoAnalysisInfo().PromoterVideoAnalysisInfoHandler, args=(promoterId, cookie))
|
|
|
+ p5 = Process(target=PromoterVideoAnalysisTrend().PromoterVideoAnalysisTrendHandler, args=(promoterId, cookie))
|
|
|
p1.start()
|
|
|
p2.start()
|
|
|
p3.start()
|
|
|
p4.start()
|
|
|
p5.start()
|
|
|
- return reuslt
|
|
|
+ return rollback
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
- app.run(port=9999, host=ConfConstant.URL, debug=True)
|
|
|
+ app.run(port=9999, debug=True)
|