data_received is an asyncio.Protocol callback that a transport invokes whenever bytes arrive. Because one response may produce multiple calls, implementations accumulate the bytes in an internal buffer. section 8.2
Use data_received as part of a larger transport-and-protocol lifecycle:
- Receive bytes from the transport each time the connection delivers data. section 8.2
- Append successive calls to an internal response buffer rather than assuming one complete response. section 8.2
- Wait for eof_received to determine that no further data_received calls will occur. section 8.2
Receiving an HTTP response
An asyncio.Protocol sends an HTTP GET request through connection_made. data_received collects the returned bytes, and eof_received marks the response complete so a Future can deliver it to get_response. section 8.2
