-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheatsheet.py
More file actions
31 lines (23 loc) · 842 Bytes
/
cheatsheet.py
File metadata and controls
31 lines (23 loc) · 842 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
29
30
31
from flask import Flask, render_template, request
import json
import gspread
from oauth2client.client import SignedJwtAssertionCredentials
app = Flask(__name__)
def get_spreadsheet_data():
json_key = json.load(open('spreadsheet_credentials.json'))
scope = ['https://spreadsheets.google.com/feeds']
credentials = SignedJwtAssertionCredentials(json_key['client_email'], json_key['private_key'], scope)
gc = gspread.authorize(credentials)
sh = gc.open("Simple Sheet")
sh = sh.sheet1
allval = sh.get_all_values()
return allval
@app.route("/")
def index():
return render_template("index.html")
@app.route("/templates/submit", methods=['POST'])
def submit():
name = request.form.get('name')
return render_template("submit.html", name=name)
if __name__=='__main__':
app.run(debug=True)