-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
28 lines (20 loc) · 737 Bytes
/
Copy pathapp.py
File metadata and controls
28 lines (20 loc) · 737 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
from flask import Flask, render_template, request
from converter import converter
app = Flask(__name__)
app.secret_key = b'_5#y2L"F4Q8z\n\xec]/'
@app.route('/', methods=['GET', 'POST'])
def index():
error = None
if request.method == 'POST':
file = request.files['file']
if file.filename == '':
error = 'No selected file'
return render_template('index.html', error=error)
if file.filename.rsplit('.', 1)[1].lower() != 'pdf':
error = "It's not .pdf file"
return render_template('index.html', error=error)
mp3 = converter(file)
return render_template('index.html', error=error)
if __name__ == "__main__":
app.debug = True
app.run()