コード例 #1
0
    def post(self):

        # parse arguments
        first = True
        arg = None
        arguments = []
        idx = 0
        while first or (arg is not None):
            arg_str = u'%d_' % idx
            arg = self.get_argument(arg_str, None)
            if arg is not None:
                arguments.append(arg)
            first = False
            idx += 1

        with SctpClientInstance() as sctp_client:

            keys = Keynodes(sctp_client)
            sc_session = logic.ScSession(self, sctp_client, keys)

            res = {}
            for addr in arguments:
                tooltip = logic.find_tooltip(ScAddr.parse_from_string(addr),
                                             sctp_client, keys,
                                             sc_session.get_used_language())
                res[addr] = tooltip

            self.set_header("Content-Type", "application/json")
            self.finish(json.dumps(res))
コード例 #2
0
ファイル: api.py プロジェクト: blrB/sc-web
    def post(self):

        # parse arguments
        first = True
        arg = None
        arguments = []
        idx = 0
        while first or (arg is not None):
            arg_str = u'%d_' % idx
            arg = self.get_argument(arg_str, None)
            if arg is not None:
                arguments.append(arg)
            first = False
            idx += 1
            
        with SctpClientInstance() as sctp_client:
                
            keys = Keynodes(sctp_client)
            sc_session = logic.ScSession(self, sctp_client, keys)
    
            res = {}
            for addr in arguments:
                tooltip = logic.find_tooltip(ScAddr.parse_from_string(addr), sctp_client, keys, sc_session.get_used_language())
                res[addr] = tooltip
    
            self.set_header("Content-Type", "application/json")
            self.finish(json.dumps(res))