Skip to content

Commit

Permalink
add versionadded tags, rename base class, fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
sseg committed Jun 3, 2016
1 parent d55740d commit 3938b38
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 6 additions & 3 deletions aiohttp/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,15 @@
MSG_SIZE = 2 ** 14


MessageBase = collections.namedtuple('Message', ['tp', 'data', 'extra'])
_MessageBase = collections.namedtuple('Message', ['tp', 'data', 'extra'])


class Message(MessageBase):
class Message(_MessageBase):
def json(self, *, loads=json.loads):
"""Return parsed JSON data."""
"""Return parsed JSON data.
.. versionadded:: 0.22
"""
return loads(self.data)


Expand Down
4 changes: 3 additions & 1 deletion docs/web_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ WebSocketResponse

:raise TypeError: if message is :const:`~aiohttp.websocket.MSG_TEXT`.

.. coroutinemethod:: recieve_json(*, loads=json.loads)
.. coroutinemethod:: receive_json(*, loads=json.loads)

A :ref:`coroutine<coroutine>` that calls :meth:`receive`, asserts the
message type is :const:`~aiohttp.websocket.MSG_TEXT`, and loads the JSON
Expand All @@ -928,6 +928,8 @@ WebSocketResponse
:raise TypeError: if message is :const:`~aiohttp.websocket.MSG_BINARY`.
:raise ValueError: if message is not valid JSON.

.. versionadded:: 0.22


.. versionadded:: 0.14

Expand Down

0 comments on commit 3938b38

Please sign in to comment.