-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
35 lines (23 loc) · 895 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
31
32
33
34
35
from flask import render_template, Flask
import foo
app = Flask(__name__)
legislators = foo.get_legislators()
committees = foo.get_committees()
@app.route('/')
def homepage():
oldest_legislators = sorted(legislators, key=lambda x: x['years_served'], reverse=True)
top_committees = [c for c in committees if not c['parent_id']]
html = render_template('homepage.html',
legislators=oldest_legislators,
committees=top_committees)
return html
if __name__ == '__main__':
app.run(use_reloader=True, debug=True)
# from datafoo import congress
# app = Flask(__name__)
# congressmembers = congress.get_legislators()
# @app.route('/')
# def homepage():
# oldtoyoung = sorted(congressmembers, key=lambda x: x['bio']['birthday'])
# html = render_template('homepage.html', legislators=oldtoyoung)
# return html