aiocoap.oscore_sitewrapper module

This module assists in creating OSCORE servers by proving a wrapper around a :class:aiocoap.resource.Site. It enforces no access control, but just indicates to the resources whether a client is authenticated by setting the request’s remote property adaequately.

So far, it needs to be utilized explicitly and manually at server creation. How this will later be automated will depend on th edirection Site is going – if all of aiocoap.protocol.Context.render_to_plumbing_request() can be moved into Site wrappers, this can stay a site wrapper – otherwise, it may need to move in there to start render_to_plumbing_request on the unprotected requests again. (This will also influence a future inner-blockwise implementation).

class aiocoap.oscore_sitewrapper.OscoreSiteWrapper(inner_site, server_credentials)

Bases: aiocoap.interfaces.Resource

needs_blockwise_assembly(request)

Indicator to the protocol.Responder about whether it should assemble request blocks to a single request and extract the requested blocks from a complete-resource answer (True), or whether the resource will do that by itself (False).

render(request)

Return a message that can be sent back to the requester.

This does not need to set any low-level message options like remote, token or message type; it does however need to set a response code.

A response returned may carry a no_response option (which is actually specified to apply to requests only); the underlying transports will decide based on that and its code whether to actually transmit the response.