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.

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.

render_to_pipe(pipe)

Create any number of responses (as indicated by the request) into the request stream.

This method is provided by the base Resource classes; if it is overridden, then render(), needs_blockwise_assembly() and ObservableResource.add_observation() are not used any more. (They still need to be implemented to comply with the interface definition, which is yet to be updated).