Skip to content

Commit

Permalink
Some docs fixes (#1031)
Browse files Browse the repository at this point in the history
* Explicitly set bash sphinx lexer

* Avoid sphinx warning about missing term

* Add notes on websocket read methods usage

* Fix stray md inline literal
  • Loading branch information
mpaolini authored and asvetlov committed Aug 1, 2016
1 parent acf6594 commit 8f0a5ea
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
10 changes: 7 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ Features
Library Installation
--------------------

::
.. code-block:: bash
$ pip install aiohttp
You may want to install *optional* :term:`cchardet` library as faster
replacement for :term:`chardet`::
replacement for :term:`chardet`:

.. code-block:: bash
$ pip install cchardet
Expand Down Expand Up @@ -114,7 +116,9 @@ Dependencies
- *Optional* :term:`cchardet` library as faster replacement for
:term:`chardet`.

Install it explicitly via::
Install it explicitly via:

.. code-block:: bash
$ pip install cchardet
Expand Down
25 changes: 23 additions & 2 deletions docs/web_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -844,13 +844,18 @@ WebSocketResponse

:raise ValueError: if data is not serializable object

:raise TypeError: if value returned by :term:`dumps` is not :class:`str`
:raise TypeError: if value returned by ``dumps`` param is not :class:`str`

.. coroutinemethod:: close(*, code=1000, message=b'')

A :ref:`coroutine<coroutine>` that initiates closing
handshake by sending :const:`~aiohttp.WSMsgType.close` message.

.. note::

Can only be called by the request handling task. To programmatically
close websocket server side see the :ref:`FAQ section <aiohttp_faq_terminating_websockets>`.

:param int code: closing code

:param message: optional payload of *pong* message,
Expand All @@ -876,6 +881,10 @@ WebSocketResponse
:exc:`~aiohttp.errors.WSClientDisconnectedError` with
connection closing data.

.. note::

Can only be called by the request handling task.

:return: :class:`~aiohttp.WSMessage`

:raise RuntimeError: if connection is not started
Expand All @@ -888,6 +897,10 @@ WebSocketResponse
also asserts the message type is
:const:`~aiohttp.WSMsgType.text`.

.. note::

Can only be called by the request handling task.

:return str: peer's message content.

:raise TypeError: if message is :const:`~aiohttp.WSMsgType.binary`.
Expand All @@ -898,6 +911,10 @@ WebSocketResponse
also asserts the message type is
:const:`~aiohttp.WSMsgType.binary`.

.. note::

Can only be called by the request handling task.

:return bytes: peer's message content.

:raise TypeError: if message is :const:`~aiohttp.WSMsgType.text`.
Expand All @@ -907,6 +924,10 @@ WebSocketResponse
A :ref:`coroutine<coroutine>` that calls :meth:`receive_str` and loads the
JSON string to a Python dict.

.. note::

Can only be called by the request handling task.

:param callable loads: any :term:`callable` that accepts
:class:`str` and returns :class:`dict`
with parsed JSON (:func:`json.loads` by
Expand All @@ -932,7 +953,7 @@ json_response
dumps=json.dumps)

Return :class:`Response` with predefined ``'application/json'``
content type and *data* encoded by *dumps* parameter
content type and *data* encoded by ``dumps`` parameter
(:func:`json.dumps` by default).


Expand Down

0 comments on commit 8f0a5ea

Please sign in to comment.