wotpy.protocols.server

Class that represents the abstract server interface.

Classes

BaseProtocolServer(port) Base protocol server class.
class wotpy.protocols.server.BaseProtocolServer(port)

Bases: object

Base protocol server class. This is the interface that must be implemented by all server classes.

add_codec(codec)

Adds a BaseCodec to this server.

add_exposed_thing(exposed_thing)

Adds the given ExposedThing to this server.

build_base_url(hostname, thing)

Returns the base URL for the given Thing in the context of this server.

build_forms(hostname, interaction)

Builds and returns a list with all Form that are linked to this server for the given Interaction.

codec_for_media_type(media_type)

Returns a BaseCodec to serialize or deserialize content for the given media type.

exposed_thing_set

Returns the ExposedThingSet instance that contains the ExposedThings of this server.

exposed_things

Returns an iterator for all the ExposedThings contained in this server.

get_exposed_thing(name)

Finds and returns an ExposedThing contained in this server by name. Raises ValueError if the ExposedThing is not present.

port

Port property.

protocol

Server protocol.

remove_exposed_thing(thing_id)

Removes the given ExposedThing from this server.

start()

Coroutine that starts the server.

stop()

Coroutine that stops the server. Some requests could be still in progress and would be served after the server has stopped.