wotpy.protocols.server
Class that represents the abstract server interface.
Classes
|
Base protocol server class. |
- class wotpy.protocols.server.BaseProtocolServer(port, form_port=None)
Bases:
objectBase 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.
- abstractmethod build_base_url(hostname, thing)
Returns the base URL for the given Thing in the context of this server.
- abstractmethod 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.
- property exposed_thing_set
Returns the ExposedThingSet instance that contains the ExposedThings of this server.
- property exposed_things
Returns an iterator for all the ExposedThings contained in this server.
- property form_port
Port that will be used inside of forms in case it differs from the server’s port for example in cases of a proxy.
- get_exposed_thing(title)
Finds and returns an ExposedThing contained in this server by name. Raises ValueError if the ExposedThing is not present.
- property port
Port property.
- abstract property protocol
Server protocol.
- remove_exposed_thing(thing_id)
Removes the given ExposedThing from this server.
- abstractmethod async start(servient)
Coroutine that starts the server.
- abstractmethod async stop()
Coroutine that stops the server. Some requests could be still in progress and would be served after the server has stopped.