kepler.api.api_doc module¶
The module contains helper functions for documenting the REST API and creating an HTML page from the documentation.
-
class
kepler.api.api_doc.
ApiDocObject
(func_name, desc, params=None, example=None, param_type=None)¶ Bases:
object
ApiDocObject
represents the REST API call documentation.Initialises the documentation object.
Parameters: - func_name – The name of the function.
- desc – The description of the call.
- params – The optional description for the call parameters.
- example – The optional example of the call.
- param_type – The optional ApiParams derived class object that defines the parameters accepted by the call.
-
static
add_api_doc
(x)¶ Static method that adds a new
ApiDocObject
to the collection of all API documentation objects.Parameters: x – The ApiDocObject
added to the API documentation.
-
static
get_api_docs
()¶ Returns sorted list of documentend REST API function names.
-
to_str
(href_call)¶ The method converts the
ApiDocObject
to reStructuredText.Parameters: href_call – If true, the resulting string includes a link to the the call that this ApiDocObject
represents.
-
toc_item
()¶ Retruns the reStructuredText string used in the table of contents for the call that this object documents.
-
kepler.api.api_doc.
generate_api_doc
(writer_name=None, include_toc=True)¶ Function generates the REST API documentation using docutils library. The format of the resulting string is determined by the document writer specified by the parameter
writer_name
. Ifwriter_name
isNone
, the documentation source in restructured text format is returned.Parameters: writer_name – The name of the docutils document writer. Returns: The REST API documentation as string generated by the specified document writer. The resulting string is encoded in UTF-8.
-
kepler.api.api_doc.
rest_api_view
(request)¶ REST API view views documentation for all API calls decorated with
rest_api
decorator.