Skip to content

Commit

Permalink
Auto generated docs should use static artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
parthea committed Jan 14, 2021
1 parent cc2461d commit b6b6dbb
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions describe.py
Expand Up @@ -37,6 +37,7 @@
from googleapiclient.discovery import build
from googleapiclient.discovery import build_from_document
from googleapiclient.discovery import UnknownApiNameOrVersion
from googleapiclient.discovery_cache import get_static_doc
from googleapiclient.http import build_http
from googleapiclient.errors import HttpError

Expand Down Expand Up @@ -395,16 +396,7 @@ def document_api(name, version, uri):
"""
try:
service = build(name, version)

http = build_http()
response, content = http.request(
uri or uritemplate.expand(
FLAGS.discovery_uri_template, {"api": name, "apiVersion": version}
)
)
if 'status' in response:
if response['status'] == '404':
raise UnknownApiNameOrVersion
content = googleapiclient.discovery_cache.get_static_doc(name, version)
except UnknownApiNameOrVersion as e:
print("Warning: {} {} found but could not be built.".format(name, version))
return
Expand Down

0 comments on commit b6b6dbb

Please sign in to comment.