-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
39 lines (33 loc) · 925 Bytes
/
app.py
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
35
36
37
38
39
from flask import Flask, request, render_template, url_for
import json
import os
import subprocess
app = Flask(__name__)
#
# Route.
#
@app.route('/getschema',methods=["GET", "POST"])
def getschema():
sd = request.form.get("subdomain","")
sn = request.form.get("scriptname","")
sk = request.form.get("scriptkey","")
subprocess.run(["python",
"getshemaSG.py",
"--nameserver",
sd,
"--scriptname",
sn,
"--scriptkey",
sk,
])
return ""
# faire generation de class python ...
@app.route('/')
def home():
if os.path.exists('schema.json') is False:
return render_template('shotgun.html')
with open('schema.json') as f:
data = json.load(f)
return render_template('index.html', entities=data)
if __name__ == '__main__':
app.run(debug=True,port=5050)