diff options
author | Joe Gregorio <jcgregorio@google.com> | 2011-04-01 17:44:25 -0400 |
---|---|---|
committer | Joe Gregorio <jcgregorio@google.com> | 2011-04-01 17:44:25 -0400 |
commit | 20a5aa983e690a74e3cf51765721cce919cb50b8 (patch) | |
tree | 0b1c52e29162a9a092e1b5ed46194f8a55037dc6 /describe.py | |
parent | 37de7a3b3a41facb8f014e8ccc915b528e7d7720 (diff) | |
download | google-api-python-client-20a5aa983e690a74e3cf51765721cce919cb50b8.tar.gz |
Updated copyright notices where appropriate and refreshed generated docs.
Diffstat (limited to 'describe.py')
-rw-r--r-- | describe.py | 44 |
1 files changed, 29 insertions, 15 deletions
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.") |