flaskBack.py 682 B

1234567891011121314151617181920212223242526
  1. from flask import Flask, request
  2. from interface import annotate
  3. from flask_cors import CORS
  4. from flask import jsonify
  5. from utils.fileio import load_json
  6. app = Flask("PrivacyScan")
  7. cors = CORS(app, resources={r"/scan": {"origins": "*"}})
  8. @app.route("/scan", methods=['POST'])
  9. def scan():
  10. source = request.get_json()['source']
  11. entire = request.get_json()['entire']
  12. data_type = request.get_json()['dataType']
  13. purpose_dict = request.get_json()['purpose']
  14. lattice = {'dataType': data_type, 'purpose': purpose_dict}
  15. result = annotate(source, lattice,
  16. entire)
  17. print(source)
  18. return jsonify(result)
  19. if __name__ == '__main__':
  20. app.run()