Repository navigation
Expand file tree
/
Copy pathserv.py
More file actions
61 lines (48 loc) · 1.38 KB
/
Copy pathserv.py
File metadata and controls
61 lines (48 loc) · 1.38 KB
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
from flask import Flask, render_template, request, url_for, redirect
from foxbot.sel import *
import time
import random
import string
from datetime import date
from templates.test import *
app = Flask(__name__)
uh = []
@app.route('/')
@app.route('/index')
def index():
return render_template("dropdown.html")
@app.route('/test', methods=['GET', 'POST'])
def login():
print("login active")
print("what the fuck")
if request.method == "POST":
print (request.form['test'])
return loop()
'''if request.method == "POST":
car_brand = request.form.get("cars", None)
if car_brand!=None:
return render_template("./dropdown.html", car_brand = car_brand)
if request.method == 'GET':'''
#return render_template("dropdown.html")
@app.route('/test/submit', methods=['POST'])
def log2():
if request.method == "POST":
print (request.form)
test_num = request.form['num']
student_id = request.form['student']
answers = {}
for i in request.form:
uh.append(i)
if i == 'num':
test_num = request.form[i]
elif i == 'student':
student_id = request.form[i]
else:
print(test_num, student_id, answers)
answers[i] = request.form[i]
test_data = open("./students/" + str(student_id)+".txt", "w")
for items in [test_num + '\n', student_id + '\n', str(answers)]:
test_data.write(items)
return "Test received"
if __name__ == '__main__':
app.run(debug=True)