Skip to content

Commit

Permalink
docs: support python3 to generate docs (#801)
Browse files Browse the repository at this point in the history
Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
  • Loading branch information
Billy4195 and busunkim96 committed Apr 20, 2020
1 parent 43fc0cf commit 84d4561
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions describe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -450,7 +453,10 @@ def document_api_from_discovery_document(uri):
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.")

0 comments on commit 84d4561

Please sign in to comment.