12345678910111213141516171819202122 |
- #import os
- import subprocess
- from flask import Flask, jsonify
- app = Flask(__name__)
-
- cmd = ['./parserDemo', 'testNodeset.xml', 'testNodeset100nodes.xml']
-
- @app.route('/parse', methods=['GET'])
- def get_parse():
- with open('parser_output.txt', 'w') as out:
- return_code = subprocess.call(cmd, stdout=out)
- return jsonify({"success":"true"})
-
- @app.route('/hello', methods=['GET'])
- def get_hello():
- return jsonify({"success":"alive"})
-
- if __name__ == '__main__':
- app.run(debug=True,port=8001)
|