aiocoap.blockwise module¶
Helpers for the implementation of RFC7959 blockwise transfers
- exception aiocoap.blockwise.ContinueException(block1)¶
Bases:
ConstructionRenderableError
Not an error in the CoAP sense, but an error in the processing sense, indicating that no complete request message is available for processing.
It reflects back the request’s block1 option when rendered.
- to_message()¶
Create a CoAP message that should be sent when this exception is rendered
- code = <Successful Response Code 95 "2.31 Continue">¶
Code assigned to messages built from it
- exception aiocoap.blockwise.IncompleteException(message=None)¶
Bases:
ConstructionRenderableError
- code = <Response Code 136 "4.08 Request Entity Incomplete">¶
Code assigned to messages built from it
- class aiocoap.blockwise.Block1Spool¶
Bases:
object
- class aiocoap.blockwise.Block2Cache¶
Bases:
object
A cache of responses to a give block key.
Use this when result rendering is expensive, not idempotent or has varying output – otherwise it’s often better to calculate the full response again and serve chunks.
- async extract_or_insert(req: Message, response_builder: coroutine)¶
Given a request message,
if it is querying a particular block, look it up in the cache or raise Request Entity Incomplete.
otherwise, * await the response builder * return the response if it doesn’t need chunking, or * return the first chunk and store it for later use