Add primitive file uploading for testing
This commit is contained in:
parent
697165fb63
commit
3dee27732c
1
validator/.gitignore
vendored
1
validator/.gitignore
vendored
@ -1 +1,2 @@
|
||||
env/
|
||||
__pycache__/
|
||||
|
@ -1,10 +1,24 @@
|
||||
from flask import Flask
|
||||
from flask import Flask, render_template, request
|
||||
import json
|
||||
import validator
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return json.dumps({"Hello": "World!"})
|
||||
return render_template('index.html')
|
||||
|
||||
@app.route('/validator', methods=['GET', 'POST'])
|
||||
def validate():
|
||||
if request.method == 'POST':
|
||||
print(request.files)
|
||||
f = request.files['file']
|
||||
|
||||
text = validator.process_file(f)
|
||||
result = validator.validate(text)
|
||||
return jsonify(result)
|
||||
else:
|
||||
return 'Soubor byl zvalidován. TODO musím ověřit, jak byl zvalidován.' # TODO change
|
||||
|
||||
|
||||
app.run()
|
9
validator/templates/index.html
Normal file
9
validator/templates/index.html
Normal file
@ -0,0 +1,9 @@
|
||||
<html>
|
||||
<body>
|
||||
<form action = "http://localhost:5000/validator" method = "POST"
|
||||
enctype = "multipart/form-data">
|
||||
<input type = "file" name = "file" /> <!-- TODO hláška-->
|
||||
<input type = "submit"/>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
@ -29,3 +29,6 @@ def validate_signature():
|
||||
|
||||
def validate_date():
|
||||
pass
|
||||
|
||||
def validate(text):
|
||||
pass
|
Loading…
Reference in New Issue
Block a user