|
18 | 18 | __author__ = 'jcgregorio@google.com (Joe Gregorio)' |
19 | 19 |
|
20 | 20 |
|
| 21 | +import httplib2 |
21 | 22 | import inspect |
| 23 | +import os |
22 | 24 | import pydoc |
23 | 25 | import re |
24 | 26 |
|
25 | 27 | from apiclient.discovery import build |
26 | | - |
| 28 | +from apiclient.anyjson import simplejson |
| 29 | +from google.appengine.api import memcache |
27 | 30 | from google.appengine.ext import webapp |
| 31 | +from google.appengine.ext.webapp import template |
28 | 32 | from google.appengine.ext.webapp import util |
29 | 33 |
|
30 | 34 |
|
31 | 35 | class MainHandler(webapp.RequestHandler): |
32 | 36 |
|
33 | 37 | def get(self): |
34 | | - self.response.out.write(""" |
35 | | - <h1>Google API Client for Python Documentation</h1> |
36 | | - <ul> |
37 | | - <li><a href='/buzz/v1'>buzz</a> |
38 | | - <li><a href='/moderator/v1'>moderator</a> |
39 | | - <li><a href='/latitude/v1'>latitude</a> |
40 | | - <li><a href='/customsearch/v1'>customsearch</a> |
41 | | - <li><a href='/diacritize/v1'>diacritize</a> |
42 | | - <li><a href='/translate/v2'>translate</a> |
43 | | - <li><a href='/prediction/v1.1'>prediction</a> |
44 | | - <li><a href='/shopping/v1'>shopping</a> |
45 | | - <li><a href='/urlshortener/v1'>urlshortener</a> |
46 | | - </ul> |
47 | | - """) |
| 38 | + http = httplib2.Http(memcache) |
| 39 | + resp, content = http.request('https://www.googleapis.com/discovery/v0.3/directory?preferred=true') |
| 40 | + directory = simplejson.loads(content)['items'] |
| 41 | + path = os.path.join(os.path.dirname(__file__), 'index.html') |
| 42 | + self.response.out.write( |
| 43 | + template.render( |
| 44 | + path, {'directory': directory, |
| 45 | + })) |
48 | 46 |
|
49 | 47 |
|
50 | 48 | def render(resource): |
|
0 commit comments