server.py 850 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. from flask import Flask,request
  2. from mysql_search_utils import mysqlSearchUtils
  3. from HttpUtils import httpUtils
  4. import json
  5. app = Flask(__name__)
  6. mysql = mysqlSearchUtils()
  7. httpUtils = httpUtils()
  8. @app.route('/hello')
  9. def helloWord():
  10. print(request.path)
  11. print(request.full_path)
  12. return 'hello world'
  13. @app.route('/getOne')
  14. def getJson():
  15. responseDict = {}
  16. data = mysql.get_one()
  17. responseDict["data"] = data
  18. return responseDict
  19. @app.route('/getList')
  20. def getList():
  21. responseDict = {}
  22. list = mysql.get_all()
  23. responseDict["list"] = list
  24. return responseDict
  25. @app.route('/testReport')
  26. def testReport():
  27. rest = httpUtils.get("http://localhost:8079/getOne",{"accountId":"123"},{"accountId":"123"})
  28. return json.loads(rest)
  29. if __name__ == '__main__':
  30. app.run(host='0.0.0.0',port=8079,debug=True)