From 20a5aa983e690a74e3cf51765721cce919cb50b8 Mon Sep 17 00:00:00 2001 From: Joe Gregorio Date: Fri, 1 Apr 2011 17:44:25 -0400 Subject: Updated copyright notices where appropriate and refreshed generated docs. --- describe.py | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) (limited to 'describe.py') diff --git a/describe.py b/describe.py index 4f7fe9697..fd8c89d41 100644 --- a/describe.py +++ b/describe.py @@ -1,23 +1,32 @@ +#!/usr/bin/env python +# +# Copyright 2007 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +__author__ = 'jcgregorio@google.com (Joe Gregorio)' + import os import pydoc import re +import sys +import httplib2 +from apiclient.anyjson import simplejson from apiclient.discovery import build BASE = 'docs/dyn' -APIS = [ - ('buzz', 'v1'), - ('moderator', 'v1'), - ('latitude', 'v1'), - ('customsearch', 'v1'), - ('diacritize', 'v1'), - ('translate', 'v2'), - ('prediction', 'v1.1'), - ('shopping', 'v1'), - ('urlshortener', 'v1'), - ] - def document(resource, path): print path collections = [] @@ -44,6 +53,11 @@ def document_api(name, version): document(service, '%s.%s.' % (name, version)) if __name__ == '__main__': - for name, version in APIS: - document_api(name, version) - + http = httplib2.Http() + resp, content = http.request('https://www.googleapis.com/discovery/v0.3/directory?preferred=true') + if resp.status == 200: + directory = simplejson.loads(content)['items'] + for api in directory: + document_api(api['name'], api['version']) + else: + sys.exit("Failed to load the discovery document.") -- cgit v1.2.3