from flask import Flask, request app = Flask(__name__) @app.route('/execute', methods=['POST']) def execute_code(): python_code = request.get_data(as_text=True) try: result = exec(python_code) return str(result) except Exception as e: return str(e) if __name__ == '__main__': app.run(host='0.0.0.0', port=12345)