-
Notifications
You must be signed in to change notification settings - Fork 7
/
app.py~
34 lines (28 loc) · 1.13 KB
/
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
import httplib2
import webapp2
from google.appengine.ext.webapp import template
from apiclient.discovery import build
from oauth2client.appengine import AppAssertionCredentials
url = 'https://www.googleapis.com/auth/bigquery'
project_number = '334080054944'
credentials = AppAssertionCredentials(scope=url)
httpss = credentials.authorize(httplib2.Http())
bigquery_service = build('bigquery','v2',http=httpss)
class ShowChartPage(webapp2.RequestHandler):
def get(self):
temp_data = {}
temp_path = 'Templates/chart.html'
self.response.out.write(template.render(temp_path,temp_data))
class ShowHome(webapp2.RequestHandler):
def get(self):
template_data = {}
queryData = {'query':'SELECT word FROM [publicdata:samples.shakespeare] LIMIT 1000'}
tableData = bigquery_service.jobs()
response = tableData.query(projectId=PROJECT_NUMBER,body=queryData).execute()
template_path = 'Templates/index.html'
#self.response.out.write(template.render(template_path,template_data))
self.response.out.write(response)
application = webapp2.WSGIApplication([
('/chart',ShowChartPage),
('/', ShowHome),
], debug=True)