#!/usr/bin/python # -*- coding: UTF-8 -*- # # 模拟远端额度查询API # author: Scott Chen # date: 2019-12-18 import json from flask import Flask, Response # Flask对象 app = Flask(__name__) def response_headers(content): resp = Response(content) resp.headers['Access-Control-Allow-Origin'] = '*' return resp @app.route('/al/cus/yearLimit', methods=['GET', 'POST']) def query_year_limit(): result = { "code": "0", "msg": "跨境额度查询成功", "data": { "rows": [ { "serviceTime": "1576555391775", "result": { "totalAmount": 1474.00, "innerbalance": 24526.00 }, "success": "true", "message": "" } ] } } content = json.dumps(result) print("模拟额度返回数据:{}".format(content)) return content if __name__ == '__main__': app.run( host='127.0.0.1', port=2001, debug=True )