| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 | 
							- """
 
- 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
 
- """
 
- 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
 
- from utils.mysql_utils import MysqlUtils
 
- 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"]
 
-     sql = "select cookie from kwai_promoter.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 rollback
 
- if __name__ == '__main__':
 
-     app.run(port=9999, host=ConfConstant.URL, debug=True)
 
 
  |