-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
63 lines (43 loc) · 1.53 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import puller
import gen
from flask import Flask, render_template, jsonify, request
import os
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/team_gen')
def gener():
teams = gen.gen_teams()
print(teams)
return render_template('teams.html', data= teams)
def allowed_file(filename):
allowed_extensions = {'yaml'}
return '.' in filename and filename.rsplit('.', 1)[1].lower() in allowed_extensions
@app.route('/uploader', methods = ['GET','POST'])
def loader():
if request.method == 'POST':
if request.method == 'POST':
# Check if the post request has the file part
if 'file' not in request.files:
return 'No file part'
file = request.files['file']
# If the user does not select a file, the browser submits an empty file without a filename
if file.filename == '':
return 'No selected file'
if file and allowed_file(file.filename):
# Save the file to the upload folder
filename = os.path.join("./", file.filename)
file.save(filename)
return 'File uploaded successfully!'
else:
return 'File type not allowed'
return render_template('uploader.html')
@app.route('/api/get_all')
def api_scanner_count():
return jsonify(puller.main())
@app.route('/debug')
def debug():
return "asd"
if __name__ == '__main__':
app.run(host="0.0.0.0",debug=True, port=8080)