-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOrderDessertByName1.py
More file actions
36 lines (27 loc) · 900 Bytes
/
OrderDessertByName1.py
File metadata and controls
36 lines (27 loc) · 900 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
32
33
34
35
36
import json
import gspread
from oauth2client.client import SignedJwtAssertionCredentials
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)
wsh = gc.open("Simple Sheet")
worksheet = wsh.sheet1
heroes_list = worksheet.col_values(1)
global default_name
default_name = heroes_list[0]
print default_name
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
return 'Hello %s' % default_name
@app.route('/hello')
def hello1():
return render_template('hello_name.html',name=default_name)
@app.route('/hello/<name>')
def hello2(name):
#return name
return render_template('hello_name.html',name=name)
if __name__=='__main__':
app.run(debug=True)