List of APIs is now built dynamically.
This commit is contained in:
		| @@ -18,33 +18,31 @@ | |||||||
| __author__ = 'jcgregorio@google.com (Joe Gregorio)' | __author__ = 'jcgregorio@google.com (Joe Gregorio)' | ||||||
|  |  | ||||||
|  |  | ||||||
|  | import httplib2 | ||||||
| import inspect | import inspect | ||||||
|  | import os | ||||||
| import pydoc | import pydoc | ||||||
| import re | import re | ||||||
|  |  | ||||||
| from apiclient.discovery import build | from apiclient.discovery import build | ||||||
|  | from apiclient.anyjson import simplejson | ||||||
|  | from google.appengine.api import memcache | ||||||
| from google.appengine.ext import webapp | from google.appengine.ext import webapp | ||||||
|  | from google.appengine.ext.webapp import template | ||||||
| from google.appengine.ext.webapp import util | from google.appengine.ext.webapp import util | ||||||
|  |  | ||||||
|  |  | ||||||
| class MainHandler(webapp.RequestHandler): | class MainHandler(webapp.RequestHandler): | ||||||
|  |  | ||||||
|   def get(self): |   def get(self): | ||||||
|     self.response.out.write(""" |     http = httplib2.Http(memcache) | ||||||
|     <h1>Google API Client for Python Documentation</h1> |     resp, content = http.request('https://www.googleapis.com/discovery/v0.3/directory?preferred=true') | ||||||
|     <ul> |     directory = simplejson.loads(content)['items'] | ||||||
|       <li><a href='/buzz/v1'>buzz</a> |     path = os.path.join(os.path.dirname(__file__), 'index.html') | ||||||
|       <li><a href='/moderator/v1'>moderator</a> |     self.response.out.write( | ||||||
|       <li><a href='/latitude/v1'>latitude</a> |         template.render( | ||||||
|       <li><a href='/customsearch/v1'>customsearch</a> |             path, {'directory': directory, | ||||||
|       <li><a href='/diacritize/v1'>diacritize</a> |                    })) | ||||||
|       <li><a href='/translate/v2'>translate</a> |  | ||||||
|       <li><a href='/prediction/v1.1'>prediction</a> |  | ||||||
|       <li><a href='/shopping/v1'>shopping</a> |  | ||||||
|       <li><a href='/urlshortener/v1'>urlshortener</a> |  | ||||||
|     </ul> |  | ||||||
|     """) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| def render(resource): | def render(resource): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Joe Gregorio
					Joe Gregorio