Connection
AsyncioReadableConnection ¶
Bases: ReadableConnection
A readable connection wrapping an asyncio.StreamReader
.
__init__ ¶
__init__(reader: StreamReader)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
reader |
StreamReader
|
The reading wrapper over a stream. |
required |
readline
async
¶
readline() -> str
Read a text line from the connection.
Returns:
Type | Description |
---|---|
str
|
The line read. |
Raises:
Type | Description |
---|---|
ConnectionClosedError
|
Raised when the connection has closed. |
AsyncioWritableConnection ¶
Bases: WritableConnection
A writable connection wrapping an asyncio.StreamWriter
.
__init__ ¶
__init__(writer: StreamWriter)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
writer |
StreamWriter
|
The writing wrapper over a stream. |
required |
writeline
async
¶
writeline(line: str) -> None
Send a text line over the connection.
The input text is split into a list of lines. Each line has its whitespace characters stripped and a single newline character appended. Then, every line is sent separately over the connection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
line |
str
|
The line to send. |
required |
ReadableConnection ¶
Bases: Protocol
A connection that can read data.
readline
abstractmethod
async
¶
readline() -> str
Read a text line from the connection.
Returns:
Type | Description |
---|---|
str
|
The line read. |
Raises:
Type | Description |
---|---|
ConnectionClosedError
|
Raised when the connection has closed. |
WritableConnection ¶
Bases: Protocol
A connection that can send data.
writeline
abstractmethod
async
¶
writeline(line: str) -> None
Send a text line over the connection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
line |
str
|
The line to send. |
required |
ConnectionClosedError ¶
Raised when a connection has closed.