wotpy.wot.td

Classes that represent the JSON and JSON-LD serialization formats of a Thing Description document.

Classes

ThingDescription(doc) Class that represents a Thing Description document.
class wotpy.wot.td.ThingDescription(doc)

Bases: object

Class that represents a Thing Description document. Contains logic to validate and transform a Thing to a serialized TD and vice versa.

build_thing()

Builds a new Thing object from the serialized Thing Description.

classmethod from_thing(thing)

Builds an instance of a JSON-serialized Thing Description from a Thing object.

get_action_forms(name)

Returns a list of FormDict for the action that matches the given name.

get_event_forms(name)

Returns a list of FormDict for the event that matches the given name.

get_forms(name)

Returns a list of FormDict for the interaction that matches the given name.

get_property_forms(name)

Returns a list of FormDict for the property that matches the given name.

to_dict()

Returns the JSON Thing Description as a dict.

to_str()

Returns the JSON Thing Description as a string.

to_thing_fragment()

Returns a ThingFragment dictionary built from this TD.

classmethod validate(doc)

Validates the given Thing Description document against its schema. Raises ValidationError if validation fails.