Skip to content

Commit 994123c

Browse files
committed
Don't serve docs, instead redirect to their new home.
Reviewed in https://codereview.appspot.com/6908065/.
1 parent 4772f3d commit 994123c

File tree

1 file changed

+2
-42
lines changed
  • samples/api-python-client-doc

1 file changed

+2
-42
lines changed

samples/api-python-client-doc/main.py

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -105,48 +105,8 @@ class ResourceHandler(webapp.RequestHandler):
105105
def get(self, service_name, version, collection):
106106

107107
real_version = describe.unsafe_version(version)
108-
109-
logging.info('%s %s %s', service_name, version, collection)
110-
http = httplib2.Http(memcache)
111-
try:
112-
resource = discovery.build(service_name, real_version, http=http)
113-
except:
114-
logging.error('Failed to build service.')
115-
return self.error(404)
116-
117-
DISCOVERY_URI = ('https://www.googleapis.com/discovery/v1/apis/'
118-
'{api}/{apiVersion}/rest')
119-
response, content = http.request(
120-
uritemplate.expand(
121-
DISCOVERY_URI, {
122-
'api': service_name,
123-
'apiVersion': real_version})
124-
)
125-
root_discovery = simplejson.loads(content)
126-
collection_discovery = root_discovery
127-
128-
# descend the object path
129-
if collection:
130-
try:
131-
path = collection.split('.')
132-
if path:
133-
for method in path:
134-
resource = getattr(resource, method)()
135-
collection_discovery = collection_discovery['resources'][method]
136-
except:
137-
logging.error('Failed to parse the collections.')
138-
return self.error(404)
139-
logging.info('Built everything successfully so far.')
140-
141-
path = '%s_%s.' % (service_name, version)
142-
if collection:
143-
path += '.'.join(collection.split('/'))
144-
path += '.'
145-
146-
page = describe.document_collection(
147-
resource, path, root_discovery, collection_discovery)
148-
149-
self.response.out.write(page)
108+
return self.redirect('https://google-api-client-libraries.appspot.com/documentation/%s/%s/python/latest/%s_%s.%s.html'
109+
% (service_name, real_version, service_name, real_version, collection))
150110

151111

152112
def main():

0 commit comments

Comments
 (0)