""" Author renyupeng coding=utf-8 @Time : 2023/2/9 5:07 下午 @Site : @File : PromoterInfoWebHook.py @Software: PyCharm @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 from spider.PromoterLiveInfoSpider import PromoterLiveInfoSpider from spider.PromoterVideoAnalysisInfo import PromoterVideoAnalysisInfo from spider.PromoterVideoAnalysisTrend import PromoterVideoAnalysisTrend from multiprocessing import Process from spider.ReturnPromoterInfoSpider import ReturnPromoterInfoSpider app = Flask(__name__) def api_root(): return 'Welcome guys' @app.route('/promoterInfo/getPromoterId', methods=['POST']) 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,)) p1.start() p2.start() p3.start() p4.start() p5.start() return reuslt if __name__ == '__main__': app.run(port=9999, host=ConfConstant.URL, debug=True)