| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 | import datetimeimport loggingimport tracebackimport requestsfrom flask import json  # To read json datafrom flask import request  # To receive headersfrom flask import Flask  # To be able to start the applicationfrom Apietl.constant.ConfConstant import ConfConstantfrom Apietl.kwai_etl.report.AccountReport import AccountReportfrom Apietl.bytedance_etl.report.AdvertiserReport import AdvertiserReportapp = Flask(__name__)@app.route('/')def api_root():    return 'Welcome guys'@app.route('/webhook/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"]    AccountReport().handler(date_type, account_id, start_date, end_date)    return '200'@app.route('/webhook/bytedance_account_report', methods=['POST'])def api_webhook_bytedance_messages():    print(json.loads(request.data))    my_info = json.loads(request.data)    account_id = my_info["advertiser_id"]    start_date = my_info["start_date"]    end_date = my_info["end_date"]    date_type = my_info["date_type"]    AdvertiserReport().handler(date_type, account_id, start_date, end_date)    return '200'if __name__ == '__main__':    app.run(port=8765, host=ConfConstant.URL, debug=True)
 |