aboutsummaryrefslogtreecommitdiff
path: root/describe.py
diff options
context:
space:
mode:
authorBilly SU <g4691821@gmail.com>2020-04-21 06:15:56 +0800
committerGitHub <noreply@github.com>2020-04-20 15:15:56 -0700
commit84d45619d753cb04d957651886231034194058b6 (patch)
treecab1d6cf4b0d84c224507f0b391d7161e3ac6ec1 /describe.py
parent43fc0cf47ac1b1e90cd52422bc5abdbbf1a8e456 (diff)
downloadgoogle-api-python-client-84d45619d753cb04d957651886231034194058b6.tar.gz
docs: support python3 to generate docs (#801)
Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
Diffstat (limited to 'describe.py')
-rwxr-xr-xdescribe.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/describe.py b/describe.py
index e36db534d..1887dc2cb 100755
--- a/describe.py
+++ b/describe.py
@@ -348,7 +348,10 @@ def document_collection_recursive(resource, path, root_discovery, discovery):
html = document_collection(resource, path, root_discovery, discovery)
f = open(os.path.join(FLAGS.dest, path + "html"), "w")
- f.write(html.encode("utf-8"))
+ if sys.version_info.major < 3:
+ html = html.encode("utf-8")
+
+ f.write(html)
f.close()
for name in dir(resource):
@@ -450,7 +453,10 @@ if __name__ == "__main__":
markdown.append("\n")
with open("docs/dyn/index.md", "w") as f:
- f.write("\n".join(markdown).encode("utf-8"))
+ markdown = "\n".join(markdown)
+ if sys.version_info.major < 3:
+ markdown = markdown.encode("utf-8")
+ f.write(markdown)
else:
sys.exit("Failed to load the discovery document.")