-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
34 lines (27 loc) · 747 Bytes
/
Copy pathapp.py
File metadata and controls
34 lines (27 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from flask import Flask, request, jsonify
from auth import is_valid_key
import subprocess
app = Flask(__name__)
@app.route("/api/verify", methods=["POST"])
def verify():
api_key = request.headers.get("x-api-key")
if not is_valid_key(api_key):
return jsonify({
"error": "unauthorized",
"message": "Invalid API Key"
}), 403
result = subprocess.run(
["python3", "evaluate.py"],
capture_output=True,
text=True
)
return result.stdout
@app.route("/api/health")
def health():
return jsonify({
"ok": True,
"stage": 312,
"service": "remeda-saas-api"
})
if __name__ == "__main__":
app.run(host="127.0.0.1", port=3120, debug=True)