import datetime import logging import traceback import requests from flask import json # To read json data from flask import request # To receive headers from flask import Flask # To be able to start the application from Apietl.constant.ConfConstant import ConfConstant from Apietl.bytedance_etl.report.AdvertiserReport import AdvertiserReport from Apietl.ruixuan.report.LiveAccountReport import LiveAccountReport app = Flask(__name__) @app.route('/') def api_root(): return 'Welcome guys' @app.route('/webhook/live_account_report', methods=['POST']) def api_webhook_messages(): print(json.loads(request.data)) my_info = json.loads(request.data) account_id = my_info["account_id"] start_date = my_info["start_date"] end_date = my_info["end_date"] date_type = my_info["date_type"] LiveAccountReport().handler(date_type, account_id, start_date, end_date) return '200' if __name__ == '__main__': app.run(port=3456, host=ConfConstant.LiveURL, debug=True)