webthing/server.py
def get(self):
        """
        Handle a GET request.

        property_name -- the name of the property from the URL path
        """
        self.set_header('Content-Type', 'application/json')
        ws_href = '{}://{}'.format(
            'wss' if self.request.protocol == 'https' else 'ws',
            self.request.headers.get('Host', '')
        )

        descriptions = []
        for thing in self.things.get_things():
            description = thing.as_thing_description()
            description['links'].append({
                'rel': 'alternate',
                'href': '{}{}'.format(ws_href, thing.get_href()),
            })
            descriptions.append(description)

        self.write(json.dumps(descriptions))
def get(self):
        """
        Handle a GET request.

        property_name -- the name of the property from the URL path
        """
        self.set_header('Content-Type', 'application/json')
        ws_href = '{}://{}'.format(
            'wss' if self.request.protocol == 'https' else 'ws',
            self.request.headers.get('Host', '')
        )

        descriptions = []
        for thing in self.things.get_things():
            description = thing.as_thing_description()
            description['links'].append({
                'rel': 'alternate',
                'href': '{}{}'.format(ws_href, thing.get_href()),
            })
            descriptions.append(description)

        self.write(json.dumps(descriptions))
def get ( self ) : self . set_header ( 'Content-Type' , 'application/json' ) ws_href = '{}://{}' . format ( 'wss' if self . request . protocol == 'https' else 'ws' , self . request . headers . get ( 'Host' , '' ) ) descriptions = [ ] for thing in self . things . get_things ( ) : description = thing . as_thing_description ( ) description [ 'links' ] . append ( { 'rel' : 'alternate' , 'href' : '{}{}' . format ( ws_href , thing . get_href ( ) ) , } ) descriptions . append ( description ) self . write ( json . dumps ( descriptions ) )
Handle a GET request.

        property_name -- the name of the property from the URL path
Handle a GET request .