parse_server.py 507 B

12345678910111213141516171819202122
  1. #import os
  2. import subprocess
  3. from flask import Flask, jsonify
  4. app = Flask(__name__)
  5. cmd = ['./parserDemo', 'testNodeset.xml', 'testNodeset100nodes.xml']
  6. @app.route('/parse', methods=['GET'])
  7. def get_parse():
  8. with open('parser_output.txt', 'w') as out:
  9. return_code = subprocess.call(cmd, stdout=out)
  10. return jsonify({"success":"true"})
  11. @app.route('/hello', methods=['GET'])
  12. def get_hello():
  13. return jsonify({"success":"alive"})
  14. if __name__ == '__main__':
  15. app.run(debug=True,port=8001)