diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2016-05-16 20:23:00 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2016-05-16 20:23:00 (GMT) |
commit | 950204df9cdc1fc632e073f646e47725f5cfe0c1 (patch) | |
tree | 99b89e5ad5bc7899546cb29ce308ddadbbc530f9 /Doc/library/asyncio-stream.rst | |
parent | 7661db622892c9731c502ccdd7af130cbfd23f5c (diff) | |
download | cpython-950204df9cdc1fc632e073f646e47725f5cfe0c1.zip cpython-950204df9cdc1fc632e073f646e47725f5cfe0c1.tar.gz cpython-950204df9cdc1fc632e073f646e47725f5cfe0c1.tar.bz2 |
docs: Update asyncio docs & whatsnew
Diffstat (limited to 'Doc/library/asyncio-stream.rst')
-rw-r--r-- | Doc/library/asyncio-stream.rst | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Doc/library/asyncio-stream.rst b/Doc/library/asyncio-stream.rst index fa076df..08fe071 100644 --- a/Doc/library/asyncio-stream.rst +++ b/Doc/library/asyncio-stream.rst @@ -142,6 +142,30 @@ StreamReader This method is a :ref:`coroutine <coroutine>`. + .. coroutinemethod:: readuntil(separator=b'\n') + + Read data from the stream until ``separator`` is found. + + On success, the data and separator will be removed from the + internal buffer (consumed). Returned data will include the + separator at the end. + + Configured stream limit is used to check result. Limit sets the + maximal length of data that can be returned, not counting the + separator. + + If an EOF occurs and the complete separator is still not found, + an :exc:`IncompleteReadError` exception will be + raised, and the internal buffer will be reset. The + :attr:`IncompleteReadError.partial` attribute may contain the + separator partially. + + If the data cannot be read because of over limit, a + :exc:`LimitOverrunError` exception will be raised, and the data + will be left in the internal buffer, so it can be read again. + + .. versionadded:: 3.5.2 + .. method:: at_eof() Return ``True`` if the buffer is empty and :meth:`feed_eof` was called. @@ -251,6 +275,18 @@ IncompleteReadError Read bytes string before the end of stream was reached (:class:`bytes`). +LimitOverrunError +================= + +.. exception:: LimitOverrunError + + Reached the buffer limit while looking for a separator. + + .. attribute:: consumed + + Total number of to be consumed bytes. + + Stream examples =============== |