Skip to content

Commit c977304

Browse files
authored
Create index file for dynamically generated docs. (#702)
1 parent 20b6758 commit c977304

File tree

4 files changed

+758
-2
lines changed

4 files changed

+758
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![Compat check PyPI](https://python-compatibility-tools.appspot.com/one_badge_image?package=google-api-python-client)](https://python-compatibility-tools.appspot.com/one_badge_target?package=google-api-python-client)
55
[![Compat check github](https://python-compatibility-tools.appspot.com/one_badge_image?package=git%2Bgit%3A//github.com/googleapis/google-api-python-client.git)](https://python-compatibility-tools.appspot.com/one_badge_target?package=git%2Bgit%3A//github.com/googleapis/google-api-python-client.git)
66

7-
This is the Python client library for Google's discovery based APIs. To get started, please see the [full documentation for this library](https://developers.google.com/api-client-library/python/). Additionally, [dynamically generated documentation](http://google.github.io/google-api-python-client/docs/epy/index.html) is available for all of the APIs supported by this library.
7+
This is the Python client library for Google's discovery based APIs. To get started, please see the [docs folder](docs/README.md).
88

99
These client libraries are officially supported by Google. However, the libraries are considered complete and are in maintenance mode. This means that we will address critical bugs and security issues but will not add any new features.
1010

describe.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323

2424
__author__ = '[email protected] (Joe Gregorio)'
2525

26+
from collections import OrderedDict
2627
import argparse
28+
import collections
2729
import json
2830
import os
2931
import re
@@ -394,6 +396,7 @@ def document_api_from_discovery_document(uri):
394396
if FLAGS.discovery_uri:
395397
document_api_from_discovery_document(FLAGS.discovery_uri)
396398
else:
399+
api_directory = collections.defaultdict(list)
397400
http = build_http()
398401
resp, content = http.request(
399402
FLAGS.directory_uri,
@@ -402,5 +405,22 @@ def document_api_from_discovery_document(uri):
402405
directory = json.loads(content)['items']
403406
for api in directory:
404407
document_api(api['name'], api['version'])
408+
api_directory[api['name']].append(api['version'])
409+
410+
# sort by api name and version number
411+
for api in api_directory:
412+
api_directory[api] = sorted(api_directory[api])
413+
api_directory = OrderedDict(sorted(api_directory.items(), key = lambda x: x[0]))
414+
415+
markdown = []
416+
for api, versions in api_directory.items():
417+
markdown.append('## %s' % api)
418+
for version in versions:
419+
markdown.append('* [%s](http://googleapis.github.io/google-api-python-client/docs/dyn/%s_%s.html)' % (version, api, version))
420+
markdown.append('\n')
421+
422+
with open('docs/dyn/index.md', 'w') as f:
423+
f.write('\n'.join(markdown).encode('utf-8'))
424+
405425
else:
406426
sys.exit("Failed to load the discovery document.")

docs/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ access to many Google APIs.
1515

1616
Learn how to use the Google API Python Client with these guides:
1717

18+
### Usage Guides
19+
1820
- [Getting Started](start.md)
1921
- [Auth](auth.md)
2022
- [API Keys](api-keys.md)
@@ -32,4 +34,8 @@ Learn how to use the Google API Python Client with these guides:
3234
- [Understand Thread Safety](thread_safety.md)
3335
- [Use Google App Engine](google_app_engine.md)
3436
- [Use Django](django.md)
35-
37+
38+
### Reference Documentation
39+
40+
- Reference documentation for the the core library [googleapiclient](http://googleapis.github.io/google-api-python-client/docs/epy/index.html).
41+
- [Library reference documentation by API](dyn/index.md).

0 commit comments

Comments
 (0)