Joe Gregorio | 79daca0 | 2013-03-29 16:25:52 -0400 | [diff] [blame] | 1 | #!/usr/bin/python |
Joe Gregorio | 20a5aa9 | 2011-04-01 17:44:25 -0400 | [diff] [blame] | 2 | # |
Craig Citro | 751b7fb | 2014-09-23 11:20:38 -0700 | [diff] [blame] | 3 | # Copyright 2014 Google Inc. All Rights Reserved. |
Joe Gregorio | 20a5aa9 | 2011-04-01 17:44:25 -0400 | [diff] [blame] | 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
Joe Gregorio | 81d92cc | 2012-07-09 16:46:02 -0400 | [diff] [blame] | 17 | """Create documentation for generate API surfaces. |
| 18 | |
| 19 | Command-line tool that creates documentation for all APIs listed in discovery. |
| 20 | The documentation is generated from a combination of the discovery document and |
| 21 | the generated API surface itself. |
| 22 | """ |
| 23 | |
Joe Gregorio | 20a5aa9 | 2011-04-01 17:44:25 -0400 | [diff] [blame] | 24 | __author__ = 'jcgregorio@google.com (Joe Gregorio)' |
| 25 | |
Bu Sun Kim | c977304 | 2019-07-17 14:03:17 -0700 | [diff] [blame^] | 26 | from collections import OrderedDict |
Joe Gregorio | 79daca0 | 2013-03-29 16:25:52 -0400 | [diff] [blame] | 27 | import argparse |
Bu Sun Kim | c977304 | 2019-07-17 14:03:17 -0700 | [diff] [blame^] | 28 | import collections |
Craig Citro | 6ae34d7 | 2014-08-18 23:10:09 -0700 | [diff] [blame] | 29 | import json |
Joe Gregorio | afc45f2 | 2011-02-20 16:11:28 -0500 | [diff] [blame] | 30 | import os |
Joe Gregorio | afc45f2 | 2011-02-20 16:11:28 -0500 | [diff] [blame] | 31 | import re |
Joe Gregorio | 79daca0 | 2013-03-29 16:25:52 -0400 | [diff] [blame] | 32 | import string |
Joe Gregorio | 20a5aa9 | 2011-04-01 17:44:25 -0400 | [diff] [blame] | 33 | import sys |
Joe Gregorio | afc45f2 | 2011-02-20 16:11:28 -0500 | [diff] [blame] | 34 | |
John Asmuth | 864311d | 2014-04-24 15:46:08 -0400 | [diff] [blame] | 35 | from googleapiclient.discovery import DISCOVERY_URI |
| 36 | from googleapiclient.discovery import build |
| 37 | from googleapiclient.discovery import build_from_document |
Jon Wayne Parrott | fd2f99c | 2016-02-19 16:02:04 -0800 | [diff] [blame] | 38 | from googleapiclient.discovery import UnknownApiNameOrVersion |
Igor Maravić | 2243529 | 2017-01-19 22:28:22 +0100 | [diff] [blame] | 39 | from googleapiclient.http import build_http |
Joe Gregorio | 81d92cc | 2012-07-09 16:46:02 -0400 | [diff] [blame] | 40 | import uritemplate |
| 41 | |
Joe Gregorio | 81d92cc | 2012-07-09 16:46:02 -0400 | [diff] [blame] | 42 | CSS = """<style> |
| 43 | |
| 44 | body, h1, h2, h3, div, span, p, pre, a { |
| 45 | margin: 0; |
| 46 | padding: 0; |
| 47 | border: 0; |
| 48 | font-weight: inherit; |
| 49 | font-style: inherit; |
| 50 | font-size: 100%; |
| 51 | font-family: inherit; |
| 52 | vertical-align: baseline; |
| 53 | } |
| 54 | |
| 55 | body { |
| 56 | font-size: 13px; |
| 57 | padding: 1em; |
| 58 | } |
| 59 | |
| 60 | h1 { |
| 61 | font-size: 26px; |
| 62 | margin-bottom: 1em; |
| 63 | } |
| 64 | |
| 65 | h2 { |
| 66 | font-size: 24px; |
| 67 | margin-bottom: 1em; |
| 68 | } |
| 69 | |
| 70 | h3 { |
| 71 | font-size: 20px; |
| 72 | margin-bottom: 1em; |
| 73 | margin-top: 1em; |
| 74 | } |
| 75 | |
| 76 | pre, code { |
| 77 | line-height: 1.5; |
| 78 | font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; |
| 79 | } |
| 80 | |
| 81 | pre { |
| 82 | margin-top: 0.5em; |
| 83 | } |
| 84 | |
| 85 | h1, h2, h3, p { |
| 86 | font-family: Arial, sans serif; |
| 87 | } |
| 88 | |
| 89 | h1, h2, h3 { |
| 90 | border-bottom: solid #CCC 1px; |
| 91 | } |
| 92 | |
| 93 | .toc_element { |
| 94 | margin-top: 0.5em; |
| 95 | } |
| 96 | |
| 97 | .firstline { |
| 98 | margin-left: 2 em; |
| 99 | } |
| 100 | |
| 101 | .method { |
| 102 | margin-top: 1em; |
| 103 | border: solid 1px #CCC; |
| 104 | padding: 1em; |
| 105 | background: #EEE; |
| 106 | } |
| 107 | |
| 108 | .details { |
| 109 | font-weight: bold; |
| 110 | font-size: 14px; |
| 111 | } |
| 112 | |
| 113 | </style> |
| 114 | """ |
| 115 | |
Joe Gregorio | 81d92cc | 2012-07-09 16:46:02 -0400 | [diff] [blame] | 116 | METHOD_TEMPLATE = """<div class="method"> |
| 117 | <code class="details" id="$name">$name($params)</code> |
| 118 | <pre>$doc</pre> |
| 119 | </div> |
| 120 | """ |
| 121 | |
| 122 | COLLECTION_LINK = """<p class="toc_element"> |
| 123 | <code><a href="$href">$name()</a></code> |
| 124 | </p> |
| 125 | <p class="firstline">Returns the $name Resource.</p> |
| 126 | """ |
| 127 | |
| 128 | METHOD_LINK = """<p class="toc_element"> |
| 129 | <code><a href="#$name">$name($params)</a></code></p> |
| 130 | <p class="firstline">$firstline</p>""" |
| 131 | |
Joe Gregorio | bb96435 | 2013-03-03 20:45:29 -0500 | [diff] [blame] | 132 | BASE = 'docs/dyn' |
| 133 | |
Sai Cheemalapati | df61397 | 2016-10-21 13:59:49 -0700 | [diff] [blame] | 134 | DIRECTORY_URI = 'https://www.googleapis.com/discovery/v1/apis' |
Joe Gregorio | bb96435 | 2013-03-03 20:45:29 -0500 | [diff] [blame] | 135 | |
Joe Gregorio | 79daca0 | 2013-03-29 16:25:52 -0400 | [diff] [blame] | 136 | parser = argparse.ArgumentParser(description=__doc__) |
Joe Gregorio | bb96435 | 2013-03-03 20:45:29 -0500 | [diff] [blame] | 137 | |
Joe Gregorio | 79daca0 | 2013-03-29 16:25:52 -0400 | [diff] [blame] | 138 | parser.add_argument('--discovery_uri_template', default=DISCOVERY_URI, |
| 139 | help='URI Template for discovery.') |
Joe Gregorio | bb96435 | 2013-03-03 20:45:29 -0500 | [diff] [blame] | 140 | |
Joe Gregorio | 79daca0 | 2013-03-29 16:25:52 -0400 | [diff] [blame] | 141 | parser.add_argument('--discovery_uri', default='', |
| 142 | help=('URI of discovery document. If supplied then only ' |
| 143 | 'this API will be documented.')) |
Joe Gregorio | bb96435 | 2013-03-03 20:45:29 -0500 | [diff] [blame] | 144 | |
Joe Gregorio | 79daca0 | 2013-03-29 16:25:52 -0400 | [diff] [blame] | 145 | parser.add_argument('--directory_uri', default=DIRECTORY_URI, |
| 146 | help=('URI of directory document. Unused if --discovery_uri' |
| 147 | ' is supplied.')) |
Joe Gregorio | bb96435 | 2013-03-03 20:45:29 -0500 | [diff] [blame] | 148 | |
Joe Gregorio | 79daca0 | 2013-03-29 16:25:52 -0400 | [diff] [blame] | 149 | parser.add_argument('--dest', default=BASE, |
| 150 | help='Directory name to write documents into.') |
| 151 | |
Joe Gregorio | bb96435 | 2013-03-03 20:45:29 -0500 | [diff] [blame] | 152 | |
Joe Gregorio | 81d92cc | 2012-07-09 16:46:02 -0400 | [diff] [blame] | 153 | |
| 154 | def safe_version(version): |
| 155 | """Create a safe version of the verion string. |
| 156 | |
| 157 | Needed so that we can distinguish between versions |
| 158 | and sub-collections in URIs. I.e. we don't want |
| 159 | adsense_v1.1 to refer to the '1' collection in the v1 |
| 160 | version of the adsense api. |
| 161 | |
| 162 | Args: |
| 163 | version: string, The version string. |
| 164 | Returns: |
| 165 | The string with '.' replaced with '_'. |
| 166 | """ |
| 167 | |
| 168 | return version.replace('.', '_') |
| 169 | |
| 170 | |
| 171 | def unsafe_version(version): |
| 172 | """Undoes what safe_version() does. |
| 173 | |
| 174 | See safe_version() for the details. |
| 175 | |
| 176 | |
| 177 | Args: |
| 178 | version: string, The safe version string. |
| 179 | Returns: |
| 180 | The string with '_' replaced with '.'. |
| 181 | """ |
| 182 | |
| 183 | return version.replace('_', '.') |
| 184 | |
| 185 | |
| 186 | def method_params(doc): |
| 187 | """Document the parameters of a method. |
| 188 | |
| 189 | Args: |
| 190 | doc: string, The method's docstring. |
| 191 | |
| 192 | Returns: |
| 193 | The method signature as a string. |
| 194 | """ |
| 195 | doclines = doc.splitlines() |
| 196 | if 'Args:' in doclines: |
| 197 | begin = doclines.index('Args:') |
| 198 | if 'Returns:' in doclines[begin+1:]: |
| 199 | end = doclines.index('Returns:', begin) |
| 200 | args = doclines[begin+1: end] |
| 201 | else: |
| 202 | args = doclines[begin+1:] |
| 203 | |
| 204 | parameters = [] |
Thomas Coffee | 2f24537 | 2017-03-27 10:39:26 -0700 | [diff] [blame] | 205 | pname = None |
| 206 | desc = '' |
| 207 | def add_param(pname, desc): |
| 208 | if pname is None: |
| 209 | return |
Joe Gregorio | 81d92cc | 2012-07-09 16:46:02 -0400 | [diff] [blame] | 210 | if '(required)' not in desc: |
| 211 | pname = pname + '=None' |
| 212 | parameters.append(pname) |
Thomas Coffee | 2f24537 | 2017-03-27 10:39:26 -0700 | [diff] [blame] | 213 | for line in args: |
| 214 | m = re.search('^\s+([a-zA-Z0-9_]+): (.*)', line) |
| 215 | if m is None: |
| 216 | desc += line |
| 217 | continue |
| 218 | add_param(pname, desc) |
| 219 | pname = m.group(1) |
| 220 | desc = m.group(2) |
| 221 | add_param(pname, desc) |
Joe Gregorio | 81d92cc | 2012-07-09 16:46:02 -0400 | [diff] [blame] | 222 | parameters = ', '.join(parameters) |
| 223 | else: |
| 224 | parameters = '' |
| 225 | return parameters |
| 226 | |
| 227 | |
| 228 | def method(name, doc): |
| 229 | """Documents an individual method. |
| 230 | |
| 231 | Args: |
| 232 | name: string, Name of the method. |
| 233 | doc: string, The methods docstring. |
| 234 | """ |
| 235 | |
| 236 | params = method_params(doc) |
Joe Gregorio | 79daca0 | 2013-03-29 16:25:52 -0400 | [diff] [blame] | 237 | return string.Template(METHOD_TEMPLATE).substitute( |
| 238 | name=name, params=params, doc=doc) |
Joe Gregorio | 81d92cc | 2012-07-09 16:46:02 -0400 | [diff] [blame] | 239 | |
| 240 | |
| 241 | def breadcrumbs(path, root_discovery): |
| 242 | """Create the breadcrumb trail to this page of documentation. |
| 243 | |
| 244 | Args: |
| 245 | path: string, Dot separated name of the resource. |
| 246 | root_discovery: Deserialized discovery document. |
| 247 | |
| 248 | Returns: |
| 249 | HTML with links to each of the parent resources of this resource. |
| 250 | """ |
| 251 | parts = path.split('.') |
| 252 | |
| 253 | crumbs = [] |
| 254 | accumulated = [] |
| 255 | |
| 256 | for i, p in enumerate(parts): |
| 257 | prefix = '.'.join(accumulated) |
| 258 | # The first time through prefix will be [], so we avoid adding in a |
| 259 | # superfluous '.' to prefix. |
| 260 | if prefix: |
| 261 | prefix += '.' |
| 262 | display = p |
| 263 | if i == 0: |
| 264 | display = root_discovery.get('title', display) |
| 265 | crumbs.append('<a href="%s.html">%s</a>' % (prefix + p, display)) |
| 266 | accumulated.append(p) |
| 267 | |
| 268 | return ' . '.join(crumbs) |
| 269 | |
| 270 | |
| 271 | def document_collection(resource, path, root_discovery, discovery, css=CSS): |
| 272 | """Document a single collection in an API. |
| 273 | |
| 274 | Args: |
| 275 | resource: Collection or service being documented. |
| 276 | path: string, Dot separated name of the resource. |
| 277 | root_discovery: Deserialized discovery document. |
| 278 | discovery: Deserialized discovery document, but just the portion that |
| 279 | describes the resource. |
| 280 | css: string, The CSS to include in the generated file. |
| 281 | """ |
Joe Gregorio | afc45f2 | 2011-02-20 16:11:28 -0500 | [diff] [blame] | 282 | collections = [] |
Joe Gregorio | 81d92cc | 2012-07-09 16:46:02 -0400 | [diff] [blame] | 283 | methods = [] |
| 284 | resource_name = path.split('.')[-2] |
| 285 | html = [ |
| 286 | '<html><body>', |
| 287 | css, |
| 288 | '<h1>%s</h1>' % breadcrumbs(path[:-1], root_discovery), |
| 289 | '<h2>Instance Methods</h2>' |
| 290 | ] |
| 291 | |
| 292 | # Which methods are for collections. |
Joe Gregorio | afc45f2 | 2011-02-20 16:11:28 -0500 | [diff] [blame] | 293 | for name in dir(resource): |
Joe Gregorio | 81d92cc | 2012-07-09 16:46:02 -0400 | [diff] [blame] | 294 | if not name.startswith('_') and callable(getattr(resource, name)): |
| 295 | if hasattr(getattr(resource, name), '__is_resource__'): |
| 296 | collections.append(name) |
| 297 | else: |
| 298 | methods.append(name) |
Joe Gregorio | afc45f2 | 2011-02-20 16:11:28 -0500 | [diff] [blame] | 299 | |
Joe Gregorio | afc45f2 | 2011-02-20 16:11:28 -0500 | [diff] [blame] | 300 | |
Joe Gregorio | 81d92cc | 2012-07-09 16:46:02 -0400 | [diff] [blame] | 301 | # TOC |
| 302 | if collections: |
| 303 | for name in collections: |
| 304 | if not name.startswith('_') and callable(getattr(resource, name)): |
| 305 | href = path + name + '.html' |
Joe Gregorio | 79daca0 | 2013-03-29 16:25:52 -0400 | [diff] [blame] | 306 | html.append(string.Template(COLLECTION_LINK).substitute( |
| 307 | href=href, name=name)) |
Joe Gregorio | 81d92cc | 2012-07-09 16:46:02 -0400 | [diff] [blame] | 308 | |
| 309 | if methods: |
| 310 | for name in methods: |
| 311 | if not name.startswith('_') and callable(getattr(resource, name)): |
| 312 | doc = getattr(resource, name).__doc__ |
| 313 | params = method_params(doc) |
| 314 | firstline = doc.splitlines()[0] |
Joe Gregorio | 79daca0 | 2013-03-29 16:25:52 -0400 | [diff] [blame] | 315 | html.append(string.Template(METHOD_LINK).substitute( |
Joe Gregorio | 81d92cc | 2012-07-09 16:46:02 -0400 | [diff] [blame] | 316 | name=name, params=params, firstline=firstline)) |
| 317 | |
| 318 | if methods: |
| 319 | html.append('<h3>Method Details</h3>') |
| 320 | for name in methods: |
| 321 | dname = name.rsplit('_')[0] |
| 322 | html.append(method(name, getattr(resource, name).__doc__)) |
| 323 | |
| 324 | html.append('</body></html>') |
| 325 | |
| 326 | return '\n'.join(html) |
| 327 | |
| 328 | |
| 329 | def document_collection_recursive(resource, path, root_discovery, discovery): |
| 330 | |
| 331 | html = document_collection(resource, path, root_discovery, discovery) |
Joe Gregorio | afc45f2 | 2011-02-20 16:11:28 -0500 | [diff] [blame] | 332 | |
Joe Gregorio | bb96435 | 2013-03-03 20:45:29 -0500 | [diff] [blame] | 333 | f = open(os.path.join(FLAGS.dest, path + 'html'), 'w') |
Joe Gregorio | d67010d | 2012-11-05 08:57:06 -0500 | [diff] [blame] | 334 | f.write(html.encode('utf-8')) |
Joe Gregorio | afc45f2 | 2011-02-20 16:11:28 -0500 | [diff] [blame] | 335 | f.close() |
| 336 | |
Joe Gregorio | 81d92cc | 2012-07-09 16:46:02 -0400 | [diff] [blame] | 337 | for name in dir(resource): |
| 338 | if (not name.startswith('_') |
| 339 | and callable(getattr(resource, name)) |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 340 | and hasattr(getattr(resource, name), '__is_resource__') |
| 341 | and discovery != {}): |
Joe Gregorio | 81d92cc | 2012-07-09 16:46:02 -0400 | [diff] [blame] | 342 | dname = name.rsplit('_')[0] |
| 343 | collection = getattr(resource, name)() |
| 344 | document_collection_recursive(collection, path + name + '.', root_discovery, |
| 345 | discovery['resources'].get(dname, {})) |
| 346 | |
Joe Gregorio | afc45f2 | 2011-02-20 16:11:28 -0500 | [diff] [blame] | 347 | def document_api(name, version): |
Joe Gregorio | 81d92cc | 2012-07-09 16:46:02 -0400 | [diff] [blame] | 348 | """Document the given API. |
| 349 | |
| 350 | Args: |
| 351 | name: string, Name of the API. |
| 352 | version: string, Version of the API. |
| 353 | """ |
Jon Wayne Parrott | fd2f99c | 2016-02-19 16:02:04 -0800 | [diff] [blame] | 354 | try: |
| 355 | service = build(name, version) |
| 356 | except UnknownApiNameOrVersion as e: |
| 357 | print 'Warning: {} {} found but could not be built.'.format(name, version) |
| 358 | return |
| 359 | |
Igor Maravić | 2243529 | 2017-01-19 22:28:22 +0100 | [diff] [blame] | 360 | http = build_http() |
Joe Gregorio | 81d92cc | 2012-07-09 16:46:02 -0400 | [diff] [blame] | 361 | response, content = http.request( |
| 362 | uritemplate.expand( |
Joe Gregorio | bb96435 | 2013-03-03 20:45:29 -0500 | [diff] [blame] | 363 | FLAGS.discovery_uri_template, { |
Joe Gregorio | 81d92cc | 2012-07-09 16:46:02 -0400 | [diff] [blame] | 364 | 'api': name, |
| 365 | 'apiVersion': version}) |
| 366 | ) |
Craig Citro | 6ae34d7 | 2014-08-18 23:10:09 -0700 | [diff] [blame] | 367 | discovery = json.loads(content) |
Joe Gregorio | 81d92cc | 2012-07-09 16:46:02 -0400 | [diff] [blame] | 368 | |
| 369 | version = safe_version(version) |
| 370 | |
| 371 | document_collection_recursive( |
| 372 | service, '%s_%s.' % (name, version), discovery, discovery) |
| 373 | |
Joe Gregorio | afc45f2 | 2011-02-20 16:11:28 -0500 | [diff] [blame] | 374 | |
Joe Gregorio | bb96435 | 2013-03-03 20:45:29 -0500 | [diff] [blame] | 375 | def document_api_from_discovery_document(uri): |
| 376 | """Document the given API. |
| 377 | |
| 378 | Args: |
| 379 | uri: string, URI of discovery document. |
| 380 | """ |
Igor Maravić | 2243529 | 2017-01-19 22:28:22 +0100 | [diff] [blame] | 381 | http = build_http() |
Joe Gregorio | bb96435 | 2013-03-03 20:45:29 -0500 | [diff] [blame] | 382 | response, content = http.request(FLAGS.discovery_uri) |
Craig Citro | 6ae34d7 | 2014-08-18 23:10:09 -0700 | [diff] [blame] | 383 | discovery = json.loads(content) |
Joe Gregorio | bb96435 | 2013-03-03 20:45:29 -0500 | [diff] [blame] | 384 | |
| 385 | service = build_from_document(discovery) |
| 386 | |
| 387 | name = discovery['version'] |
| 388 | version = safe_version(discovery['version']) |
| 389 | |
| 390 | document_collection_recursive( |
| 391 | service, '%s_%s.' % (name, version), discovery, discovery) |
| 392 | |
| 393 | |
| 394 | if __name__ == '__main__': |
Joe Gregorio | 79daca0 | 2013-03-29 16:25:52 -0400 | [diff] [blame] | 395 | FLAGS = parser.parse_args(sys.argv[1:]) |
Joe Gregorio | bb96435 | 2013-03-03 20:45:29 -0500 | [diff] [blame] | 396 | if FLAGS.discovery_uri: |
| 397 | document_api_from_discovery_document(FLAGS.discovery_uri) |
Joe Gregorio | 20a5aa9 | 2011-04-01 17:44:25 -0400 | [diff] [blame] | 398 | else: |
Bu Sun Kim | c977304 | 2019-07-17 14:03:17 -0700 | [diff] [blame^] | 399 | api_directory = collections.defaultdict(list) |
Igor Maravić | 2243529 | 2017-01-19 22:28:22 +0100 | [diff] [blame] | 400 | http = build_http() |
Joe Gregorio | bb96435 | 2013-03-03 20:45:29 -0500 | [diff] [blame] | 401 | resp, content = http.request( |
| 402 | FLAGS.directory_uri, |
| 403 | headers={'X-User-IP': '0.0.0.0'}) |
| 404 | if resp.status == 200: |
Craig Citro | 6ae34d7 | 2014-08-18 23:10:09 -0700 | [diff] [blame] | 405 | directory = json.loads(content)['items'] |
Joe Gregorio | bb96435 | 2013-03-03 20:45:29 -0500 | [diff] [blame] | 406 | for api in directory: |
| 407 | document_api(api['name'], api['version']) |
Bu Sun Kim | c977304 | 2019-07-17 14:03:17 -0700 | [diff] [blame^] | 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 | |
Joe Gregorio | bb96435 | 2013-03-03 20:45:29 -0500 | [diff] [blame] | 425 | else: |
| 426 | sys.exit("Failed to load the discovery document.") |