Пример #1
0
    def print_output(respjson, **kwargs):
        mainkey = kwargs.get('mainkey', None)
        subkey = kwargs.get('subkey', None)
        listkey = kwargs.get('listkey', None)

        if (sys.version_info > (3, 0)):
            if isinstance(respjson, (bytes, str)):
                if len(respjson.strip()) == 0:
                    return
        else:
            if isinstance(respjson, (str, unicode)):
                if len(respjson.strip()) == 0:
                    return

        if mainkey is None and listkey is None:
            print(respjson)
            raise "Output error!"
        if not (OtcConfig.QUERY is None):
            utils_output.handleQuery(respjson, OtcConfig.QUERY)
        elif subkey is None and listkey is None:
            utils_output.printJsonTableTransverse(respjson, "table", mainkey)
        elif subkey is None:
            utils_output.printLevel2(respjson, "table", mainkey, listkey)
        else:
            utils_output.printLevel2(respjson,
                                     "table",
                                     mainkey,
                                     listkey,
                                     subkey=subkey)
Пример #2
0
 def print_output(respjson, **kwargs):
     mainkey = kwargs.get('mainkey', None)
     subkey= kwargs.get('subkey', None)
     listkey = kwargs.get('listkey', None)        
     
     if mainkey is None:
         print(respjson)
         raise "Output error!"
     if not (OtcConfig.QUERY is None):
         utils_output.handleQuery(respjson, OtcConfig.QUERY)
     elif subkey is None and listkey is None:
         utils_output.printJsonTableTransverse(respjson, "text", mainkey)
     elif subkey is None:
         utils_output.printLevel2(respjson, "text", mainkey, listkey)
     else:
         utils_output.printLevel2(respjson, "text", mainkey, listkey,subkey=subkey)
Пример #3
0
    def print_output(respjson, **kwargs):
        mainkey = kwargs.get('mainkey', None)
        subkey = kwargs.get('subkey', None)
        listkey = kwargs.get('listkey', None)

        if mainkey is None and listkey is None:
            print(respjson)
            raise "Output error!"
        if not (OtcConfig.QUERY is None):
            utils_output.handleQuery(respjson, OtcConfig.QUERY)
        elif subkey is None and listkey is None:
            utils_output.printJsonTableTransverse(respjson, "table", mainkey)
        elif subkey is None:
            utils_output.printLevel2(respjson, "table", mainkey, listkey)
        else:
            utils_output.printLevel2(respjson,
                                     "table",
                                     mainkey,
                                     listkey,
                                     subkey=subkey)
Пример #4
0
    def print_output(respjson, **kwargs):
        mainkey = kwargs.get('mainkey', None)
        subkey= kwargs.get('subkey', None)
        listkey = kwargs.get('listkey', None)

        if isinstance(respjson, str):
            if len(respjson.strip()) == 0:
                return

        if mainkey is None:
            print(respjson)
            raise Exception("Output error!")
        if not (OtcConfig.QUERY is None):
            utils_output.handleQuery(respjson, OtcConfig.QUERY)
        elif subkey is None and listkey is None:
            utils_output.printJsonTableTransverse(respjson, "text", mainkey)
        elif subkey is None:
            utils_output.printLevel2(respjson, "text", mainkey, listkey)
        else:
            utils_output.printLevel2(respjson, "text", mainkey, listkey,subkey=subkey)
Пример #5
0
 def handleQuery(result):
     utils_output.handleQuery(result, OtcConfig.QUERY)
Пример #6
0
 def handleQuery(result):
     utils_output.handleQuery(result, OtcConfig.QUERY)