Example #1
0
File: api.py Project: blrB/sc-web
    def get(self):

        with SctpClientInstance() as sctp_client:
    
            keys = Keynodes(sctp_client)
            keynode_nrel_format = keys[KeynodeSysIdentifiers.nrel_format]
            keynode_nrel_mimetype = keys[KeynodeSysIdentifiers.nrel_mimetype]
        
            # parse arguments
            addr = ScAddr.parse_from_string(self.get_argument('addr', None))        
            if addr is None:
                return logic.serialize_error(self, 404, 'Invalid arguments')
        
            result = sctp_client.get_link_content(addr)
            if result is None:
                return logic.serialize_error(self, 404, 'Content not found')
        
            self.set_header("Content-Type", logic.get_link_mime(addr, keynode_nrel_format, keynode_nrel_mimetype, sctp_client))
            self.finish(result)
Example #2
0
    def get(self):

        with SctpClientInstance() as sctp_client:
    
            keys = Keynodes(sctp_client)
            keynode_nrel_format = keys[KeynodeSysIdentifiers.nrel_format]
            keynode_nrel_mimetype = keys[KeynodeSysIdentifiers.nrel_mimetype]
        
            # parse arguments
            addr = ScAddr.parse_from_string(self.get_argument('addr', None))
            if addr is None:
                return serialize_error(self, 404, 'Invalid arguments')
        
            result = sctp_client.get_link_content(addr)
            if result is None:
                return serialize_error(self, 404, 'Content not found')
        
            self.set_header("Content-Type", logic.get_link_mime(addr, keynode_nrel_format, keynode_nrel_mimetype, sctp_client))
            self.finish(result)