diff --git a/sanic/app.py b/sanic/app.py index 65a6196f..edd04caf 100644 --- a/sanic/app.py +++ b/sanic/app.py @@ -305,7 +305,7 @@ class Sanic: the output URL's query string. :param view_name: string referencing the view name - :param **kwargs: keys and values that are used to build request + :param \*\*kwargs: keys and values that are used to build request parameters and query string arguments. :return: the built URL diff --git a/sanic/response.py b/sanic/response.py index eb2d3e49..c129884f 100644 --- a/sanic/response.py +++ b/sanic/response.py @@ -251,8 +251,7 @@ def text(body, status=200, headers=None, :param body: Response data to be encoded. :param status: Response code. :param headers: Custom Headers. - :param content_type: - the content type (string) of the response + :param content_type: the content type (string) of the response """ return HTTPResponse( body, status=status, headers=headers, @@ -266,8 +265,7 @@ def raw(body, status=200, headers=None, :param body: Response data. :param status: Response code. :param headers: Custom Headers. - :param content_type: - the content type (string) of the response + :param content_type: the content type (string) of the response. """ return HTTPResponse(body_bytes=body, status=status, headers=headers, content_type=content_type) @@ -316,17 +314,16 @@ def stream( content_type="text/plain; charset=utf-8"): """Accepts an coroutine `streaming_fn` which can be used to write chunks to a streaming response. Returns a `StreamingHTTPResponse`. - Example usage: - ``` - @app.route("/") - async def index(request): - async def streaming_fn(response): - await response.write('foo') - await response.write('bar') + Example usage:: - return stream(streaming_fn, content_type='text/plain') - ``` + @app.route("/") + async def index(request): + async def streaming_fn(response): + await response.write('foo') + await response.write('bar') + + return stream(streaming_fn, content_type='text/plain') :param streaming_fn: A coroutine accepts a response and writes content to that response. diff --git a/sanic/router.py b/sanic/router.py index 38b1c029..2819cc7c 100644 --- a/sanic/router.py +++ b/sanic/router.py @@ -75,9 +75,10 @@ class Router: """Parse a parameter string into its constituent name, type, and pattern - For example: - `parse_parameter_string('')` -> - ('param_one', str, '[A-z]') + For example:: + + parse_parameter_string('')` -> + ('param_one', str, '[A-z]') :param parameter_string: String to parse :return: tuple containing diff --git a/sanic/server.py b/sanic/server.py index 39816e28..11601c00 100644 --- a/sanic/server.py +++ b/sanic/server.py @@ -329,7 +329,7 @@ def serve(host, port, request_handler, error_handler, before_start=None, `app` instance and `loop` :param after_stop: function to be executed when a stop signal is received after it is respected. Takes arguments - `app` instance and `loop` + `app` instance and `loop` :param debug: enables debug output (slows server) :param request_timeout: time in seconds :param ssl: SSLContext