| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 | from flask import Flask,requestfrom utils.DataSearchUtils import MysqlSearchUtilsfrom utils.HttpUtils import HttpUtilsfrom ai_auto_create_creative_job import AiAutoCreateCreativeJobimport jsonfrom utils import ResultDictUtilsfrom flask_cors import CORSapp = Flask(__name__)CORS(app, resources=r'/*')mysql = MysqlSearchUtils()httpUtils = HttpUtils()aiAutoCreateCreativeJob = AiAutoCreateCreativeJob()@app.route('/hello')def hello_word():    print(request.path)    print(request.full_path)    return 'hello world'@app.route('/getOne')def get_json():    response_dict = {}    data = mysql.get_one()    response_dict["data"] = data    return response_dict@app.route('/getList',methods=["post"])def get_list():    body = request.json    print(body["accountId"])    response_dict = {}    list = mysql.get_all()    response_dict["list"] = list    return response_dict@app.route('/testReport',methods=["get"])def test_report():    rest = httpUtils.get("http://localhost:8079/getOne",{"accountId":"123"},{"accountId":"123"})    return json.loads(rest)@app.route('/autoCreateCreativeJob')def auto_create_creative_job():    response_dict = ResultDictUtils.common_success_dict    account_id = request.args.get("accountId")    if 0 == account_id or account_id is None:        return ResultDictUtils.params_error_dict    rest = aiAutoCreateCreativeJob.auto_create_job(account_id)    response_dict["data"] = rest    return response_dictif __name__ == '__main__':    app.run(host='0.0.0.0',port=8079,debug=True)
 |