def make_rst(self, section_title_set): # print('importing falcon app %s...' % self.arguments[0]) app = autohttp_import_object(self.arguments[0]) for method, path, handler in get_routes(app): docstring = handler.__doc__ if not isinstance(docstring, str): analyzer = ModuleAnalyzer.for_module(handler.__module__) docstring = force_decode(docstring, analyzer.encoding) if not docstring and 'include-empty-docstring' not in self.options: continue # exclude falcon HTTPMethodNotAllowed endpoints if docstring == 'Raise 405 HTTPMethodNotAllowed error': continue if not docstring: continue if hasattr(handler, '__self__'): if not (handler.__self__.allow_read_no_auth and method == 'GET'): docstring += '\n:reqheader Authorization: see :ref:`hmac-auth-label`.\n' docstring = prepare_docstring(docstring) # generate section title if needed if path.startswith('/v'): section_title = '/'.join(path.split('/')[0:3]) else: section_title = path if section_title not in section_title_set: section_title_set.add(section_title) yield section_title yield '_' * len(section_title) for line in autohttp_http_directive(method, path, docstring): yield line
def make_rst(self, section_title_set): # print('importing falcon app %s...' % self.arguments[0]) app = autohttp_import_object(self.arguments[0]) for method, path, handler in get_routes(app): docstring = handler.__doc__ if not isinstance(docstring, str): analyzer = ModuleAnalyzer.for_module(handler.__module__) docstring = force_decode(docstring, analyzer.encoding) if not docstring and 'include-empty-docstring' not in self.options: continue if not docstring: continue docstring = prepare_docstring(docstring) # generate section title if needed if path.startswith('/api'): section_title = '/'.join(path.split('/')[0:4]) else: section_title = path if section_title not in section_title_set: section_title_set.add(section_title) yield section_title yield '_' * len(section_title) for line in autohttp_http_directive(method, path, docstring): yield line