-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
30 lines (22 loc) · 844 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
from flask import Flask, render_template, flash, request
from flask.ext.wtf import Form
from wtforms import SubmitField
from wtforms.validators import Required
from flask_simplelogin import SimpleLogin
from flask_simplelogin import login_required
from api_req import get_tf_data
app = Flask(__name__)
app.config['SECRET_KEY'] = '7d441f27d441f27567d441f2b6176a'
SimpleLogin(app)
class SubmitForm(Form):
submit = SubmitField('Submit')
@app.route("/download_data", methods=['GET', 'POST'])
@login_required
def get_data():
form = SubmitForm(request.form)
if request.method == 'POST':
get_tf_data()
flash("Los datos mas recientes han sido descargados para el Sistema de Transparencia Financiera de Puerto Rico")
return render_template('download_data.html', form=form)
if __name__ == '__main__':
app.run()