Python xbmc.executeJSONRPC() Examples

The following are 30 code examples of xbmc.executeJSONRPC(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module xbmc , or try the search function .
Example #1
Source File: pushhandler.py    From xbmc.service.pushbullet with GNU General Public License v3.0 6 votes vote down vote up
def mediaPlaying(): #TODO: make sure we're checking for all media
    return StreamUtils.isPlaying()

#    xbmc.executeJSONRPC('{"jsonrpc":"2.0","id":1,"method":"Playlist.Clear","params":{"playlistid":1}}')
#    xbmc.executeJSONRPC('{"jsonrpc":"2.0","id":1,"method":"Playlist.Add","params":{"playlistid":1,"item":{"file":"' + str(url) + '"}}}')
#    return xbmc.executeJSONRPC('{"jsonrpc":"2.0","id":1,"method":"Player.Open","params":{"item":{"playlistid":1,"position":0}}}')


    '''{u'iden': u'ujxCHwc6fiSsjAl11HK7y0',
        u'created': 1411009240.141888,
        u'receiver_email': u'ruuk25@gmail.com',
        u'items': [],
        u'target_device_iden': u'ujxCHwc6fiSsjz477zOU0a',
        u'file_url': u'https://s3.amazonaws.com/pushbullet-uploads/ujxCHwc6fiS-wnH7qXNVOruppCCglRlC6iUXWHWR5xEV/IMG_20140827_164312.jpg',
        u'modified': 1411009240.149686, u'dismissed': False,
        u'sender_email_normalized': u'ruuk25@gmail.com',
        u'file_type': u'image/jpeg',
        u'image_url': u'https://pushbullet.imgix.net/ujxCHwc6fiS-wnH7qXNVOruppCCglRlC6iUXWHWR5xEV/IMG_20140827_164312.jpg',
        u'sender_email': u'ruuk25@gmail.com',
        u'file_name': u'IMG_20140827_164312.jpg',
        u'active': True,
        u'receiver_iden': u'ujxCHwc6fiS',
        u'sender_iden': u'ujxCHwc6fiS',
        u'type': u'file',
        u'receiver_email_normalized': u'ruuk25@gmail.com'}''' 
Example #2
Source File: default.py    From script.tvtime with GNU General Public License v2.0 6 votes vote down vote up
def getEpisodeTVDB(self, xbmc_id):
        rpccmd = {'jsonrpc': '2.0', 'method': 'VideoLibrary.GetEpisodeDetails', 'params': {"episodeid": int(xbmc_id), 'properties': ['season', 'episode', 'tvshowid', 'showtitle', 'uniqueid']}, 'id': 1}
        rpccmd = json.dumps(rpccmd)
        result = xbmc.executeJSONRPC(rpccmd)
        result = json.loads(result)        
        log('result=%s' % result)    
        log('episode_id=%s' % result['result']['episodedetails']['uniqueid']['unknown'])
        
        try:
            item = {}
            item['season'] = result['result']['episodedetails']['season']
            item['tvshowid'] = result['result']['episodedetails']['tvshowid']
            item['episode'] = result['result']['episodedetails']['episode']
            item['showtitle'] = result['result']['episodedetails']['showtitle']
            item['episode_id'] = result['result']['episodedetails']['uniqueid']['unknown']
            return item
        except:
            return False 
Example #3
Source File: helper.py    From romcollectionbrowser with GNU General Public License v2.0 6 votes vote down vote up
def readLibretroCores():
    Logutil.log("readLibretroCores", util.LOG_LEVEL_INFO)

    addons = []
    addonsJson = xbmc.executeJSONRPC(
        '{ "jsonrpc": "2.0", "id": 1, "method": "Addons.GetAddons", "params": { "type": "kodi.gameclient" } }')
    jsonResult = json.loads(addonsJson)
    Logutil.log("readLibretroCores: jsonresult = " + str(jsonResult), util.LOG_LEVEL_INFO)
    if str(list(jsonResult.keys())).find('error') >= 0:
        Logutil.log("Error while reading gameclient addons via json. Assume that we are not in RetroPlayer branch.",
                    util.LOG_LEVEL_WARNING)
        return False, None

    try:
        for addonObj in jsonResult[u'result'][u'addons']:
            addonid = addonObj[u'addonid']
            addons.append(addonid)
    except KeyError:
        #no addons installed or found
        return True, addons
    Logutil.log("addons: %s" % str(addons), util.LOG_LEVEL_INFO)
    return True, addons 
Example #4
Source File: utils.py    From script.tubecast with MIT License 6 votes vote down vote up
def kodi_json_request(params):
    data = json.dumps(params)
    request = xbmc.executeJSONRPC(data)

    try:
        response = json.loads(request)
    except UnicodeDecodeError:
        response = json.loads(request.decode('utf-8', 'ignore'))

    try:
        if 'result' in response:
            return response['result']
        return None
    except KeyError:
        logger.warn("[%s] %s" %
                    (params['method'], response['error']['message']))
        return None 
Example #5
Source File: kodiops.py    From plugin.video.netflix with MIT License 6 votes vote down vote up
def json_rpc(method, params=None):
    """
    Executes a JSON-RPC in Kodi

    :param method: The JSON-RPC method to call
    :type method: string
    :param params: The parameters of the method call (optional)
    :type params: dict
    :returns: dict -- Method call result
    """
    request_data = {'jsonrpc': '2.0', 'method': method, 'id': 1,
                    'params': params or {}}
    request = json.dumps(request_data)
    debug('Executing JSON-RPC: {}', request)
    raw_response = xbmc.executeJSONRPC(request)
    # debug('JSON-RPC response: {}'.format(raw_response))
    response = json.loads(raw_response)
    if 'error' in response:
        raise IOError('JSONRPC-Error {}: {}'
                      .format(response['error']['code'],
                              response['error']['message']))
    return response['result'] 
Example #6
Source File: default.py    From repository.guilouz with GNU General Public License v2.0 6 votes vote down vote up
def _edit_db_string( self,preset,type,label ):
        keyboard = xbmc.Keyboard(preset)
        keyboard.doModal()
        if (keyboard.isConfirmed()):
            try:
                InputLabel=keyboard.getText()
                conv=time.strptime(InputLabel,"%d/%m/%Y")
              #  InputLabel = Time.strftime('%Y-%m-%d')
                InputLabel = time.strftime("%Y-%m-%d",conv)
            except Exception:
                sys.exc_clear()
            if ((type == "Song") or (type == "Album") or (type == "Artist")):
                xbmc.executeJSONRPC('{"jsonrpc": "2.0", "id": 1, "method": "AudioLibrary.Set%sDetails", "params": { "%s": "%s", "%sid":%s }}' % (type,label,InputLabel,type.lower(),self.DBID))
            else:
                xbmc.executeJSONRPC('{"jsonrpc": "2.0", "id": 1, "method": "VideoLibrary.Set%sDetails", "params": { "%s": "%s", "%sid":%s }}' % (type,label,InputLabel,type.lower(),self.DBID))
        else:
            return "" 
Example #7
Source File: xbmc_context.py    From plugin.video.youtube with GNU General Public License v2.0 6 votes vote down vote up
def set_addon_enabled(self, addon_id, enabled=True):
        rpc_request = json.dumps({"jsonrpc": "2.0",
                                  "method": "Addons.SetAddonEnabled",
                                  "id": 1,
                                  "params": {"addonid": "%s" % addon_id,
                                             "enabled": enabled}
                                  })
        response = json.loads(xbmc.executeJSONRPC(rpc_request))
        try:
            return response['result'] == 'OK'
        except KeyError:
            message = response['error']['message']
            code = response['error']['code']
            error = 'Requested |%s| received error |%s| and code: |%s|' % (rpc_request, message, code)
            xbmc.log(error, xbmc.LOGDEBUG)
            return False 
Example #8
Source File: xbmc_context.py    From plugin.video.youtube with GNU General Public License v2.0 6 votes vote down vote up
def addon_enabled(self, addon_id):
        rpc_request = json.dumps({"jsonrpc": "2.0",
                                  "method": "Addons.GetAddonDetails",
                                  "id": 1,
                                  "params": {"addonid": "%s" % addon_id,
                                             "properties": ["enabled"]}
                                  })
        response = json.loads(xbmc.executeJSONRPC(rpc_request))
        try:
            return response['result']['addon']['enabled'] is True
        except KeyError:
            message = response['error']['message']
            code = response['error']['code']
            error = 'Requested |%s| received error |%s| and code: |%s|' % (rpc_request, message, code)
            xbmc.log(error, xbmc.LOGDEBUG)
            return False 
Example #9
Source File: testTasks.py    From script.service.kodi.callbacks with GNU General Public License v3.0 6 votes vote down vote up
def getWebserverInfo():
    json_query = xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "id": 0, "method": "Settings.getSettings", "params":'
                                     ' {"filter":{"section":"services", "category":"webserver"}}}')
    json_query = unicode(json_query, 'utf-8', errors='ignore')
    json_response = json.loads(json_query)

    if json_response.has_key('result') and json_response['result'].has_key('settings') and json_response['result']['settings'] is not None:
        serverEnabled = False
        serverPort = 8080
        serverUser = ''
        serverPassword = ''
        for item in json_response['result']['settings']:
            if item["id"] == u"services.webserver":
                if item["value"] is True:
                    serverEnabled = True
            elif item["id"] == u'services.webserverport':
                serverPort = item['value']
            elif item['id'] == u'services.webserverusername':
                serverUser = item['value']
            elif item['id'] == u'services.webserverpassword':
                serverPassword = item['value']
        return  serverEnabled, serverPort, serverUser, serverPassword 
Example #10
Source File: kodiops.py    From plugin.video.netflix with MIT License 6 votes vote down vote up
def json_rpc_multi(method, list_params=None):
    """
    Executes multiple JSON-RPC with the same method in Kodi

    :param method: The JSON-RPC method to call
    :type method: string
    :param list_params: Multiple list of parameters of the method call
    :type list_params: a list of dict
    :returns: dict -- Method call result
    """
    request_data = [{'jsonrpc': '2.0', 'method': method, 'id': 1, 'params': params or {}} for params in list_params]
    request = json.dumps(request_data)
    debug('Executing JSON-RPC: {}', request)
    raw_response = xbmc.executeJSONRPC(request)
    if 'error' in raw_response:
        raise IOError('JSONRPC-Error {}'.format(raw_response))
    return json.loads(raw_response) 
Example #11
Source File: player.py    From script.service.kodi.callbacks with GNU General Public License v3.0 6 votes vote down vote up
def getInfo(self):
        tries = 0
        while tries < 8 and self.isPlaying() is False:
            xbmc.sleep(250)
        try:
            player = json.loads(xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Player.GetActivePlayers", "id": 1}'))
        except RuntimeError:
            playerid = -1
            playertype = 'none'
        else:
            try:
                playerid = player['result'][0]['playerid']
                playertype = player['result'][0]['type']
            except KeyError:
                playerid = -1
                playertype = 'none'
        if playertype == 'audio':
            self.getAudioInfo(playerid)
            self.rectifyUnknowns()
        elif playertype == 'video':
            self.getVideoInfo(playerid)
            self.rectifyUnknowns()
        else:
            self.info = {} 
Example #12
Source File: update.py    From plugin.program.openwizard with GNU General Public License v3.0 6 votes vote down vote up
def addon_updates(do=None):
    setting = '"general.addonupdates"'
    if do == 'set':
        query = '{{"jsonrpc":"2.0", "method":"Settings.GetSettingValue","params":{{"setting":{0}}}, "id":1}}'.format(setting)
        response = xbmc.executeJSONRPC(query)
        match = re.compile('{"value":(.+?)}').findall(response)
        if len(match) > 0:
            default = match[0]
        else:
            default = 0
        CONFIG.set_setting('default.addonupdate', str(default))
        query = '{{"jsonrpc":"2.0", "method":"Settings.SetSettingValue","params":{{"setting":{0},"value":{1}}}, "id":1}}'.format(setting, '2')
        response = xbmc.executeJSONRPC(query)
    elif do == 'reset':
        try:
            value = int(float(CONFIG.get_setting('default.addonupdate')))
        except:
            value = 0
        if value not in [0, 1, 2]:
            value = 0
        query = '{{"jsonrpc":"2.0", "method":"Settings.SetSettingValue","params":{{"setting":{0},"value":{1}}}, "id":1}}'.format(setting, value)
        response = xbmc.executeJSONRPC(query) 
Example #13
Source File: loop.py    From script.service.kodi.callbacks with GNU General Public License v3.0 6 votes vote down vote up
def getStereoscopicMode():
    """
    Retrieves stereoscopic mode from json-rpc
    @return: "off", "split_vertical", "split_horizontal", "row_interleaved", "hardware_based", "anaglyph_cyan_red",
             "anaglyph_green_magenta", "monoscopic"
    @rtype: str
    """
    query = '{"jsonrpc": "2.0", "method": "GUI.GetProperties", "params": {"properties": ["stereoscopicmode"]}, "id": 1}'
    result = xbmc.executeJSONRPC(query)
    jsonr = jloads(result)
    ret = ''
    if 'result' in jsonr:
        if 'stereoscopicmode' in jsonr['result']:
            if 'mode' in jsonr['result']['stereoscopicmode']:
                ret = jsonr['result']['stereoscopicmode']['mode'].encode('utf-8')
    return ret 
Example #14
Source File: default.py    From ru with GNU General Public License v2.0 6 votes vote down vote up
def get_addons():
    request = {'jsonrpc': '2.0',
               'method': 'Addons.GetAddons',
               'params': {'type': 'xbmc.addon.video',
                          'content': 'video',
                          'enabled': True,
                          'properties': ['name', 'fanart', 'thumbnail', 'description']},
                'id': 1
               }
    response = xbmc.executeJSONRPC(json.dumps(request))

    j = json.loads(response)
    result = j.get('result')
    if result:
        addons = result.get('addons', [])
    else:
        addons = []

    return addons 
Example #15
Source File: default.py    From ru with GNU General Public License v2.0 6 votes vote down vote up
def get_directory( directory ):
    request = {'jsonrpc': '2.0',
               'method': 'Files.GetDirectory',
               'params': {'properties': ['title', 'genre', 'year', 'rating', 'runtime', 'plot', 'file', 'art'],
                          'directory': directory,
                          'media': 'files'},
                'id': 1
               }
    response = xbmc.executeJSONRPC(json.dumps(request))

    j = json.loads(response)
    result = j.get('result')
    if result:
        files = result.get('files', [])
    else:
        files = []

    return files 
Example #16
Source File: skin.py    From plugin.program.openwizard with GNU General Public License v3.0 6 votes vote down vote up
def look_and_feel_data(do='save'):
    from resources.libs.common import logging

    scan = ['lookandfeel.enablerssfeeds', 'lookandfeel.font', 'lookandfeel.rssedit', 'lookandfeel.skincolors',
            'lookandfeel.skintheme', 'lookandfeel.skinzoom', 'lookandfeel.soundskin', 'lookandfeel.startupwindow',
            'lookandfeel.stereostrength']
            
    if do == 'save':
        for item in scan:
            query = '{{"jsonrpc":"2.0", "method":"Settings.GetSettingValue","params":{{"setting":"{0}"}}, "id":1}}'.format(item)
            response = xbmc.executeJSONRPC(query)
            if 'error' not in response:
                match = re.compile('{"value":(.+?)}').findall(str(response))
                CONFIG.set_setting(item.replace('lookandfeel', 'default'), match[0])
                logging.log("%s saved to %s" % (item, match[0]))
    elif do == 'restore':
        for item in scan:
            value = CONFIG.get_setting(item.replace('lookandfeel', 'default'))
            query = '{{"jsonrpc":"2.0", "method":"Settings.SetSettingValue","params":{{"setting":"{0}","value":{1}}}, "id":1}}'.format(item, value)
            response = xbmc.executeJSONRPC(query)
            logging.log("{0} restored to {1}".format(item, value)) 
Example #17
Source File: common.py    From xbmc.service.pushbullet with GNU General Public License v3.0 6 votes vote down vote up
def executeJSONRPCMethod(method, params={}):

    rpc = {
        'jsonrpc': '2.0',
        'method': method,
        'params': params,
        'id': 1
    }

    # Check if is there is an active player
    activePlayers = executeJSONRPC('{"jsonrpc": "2.0", "method": "Player.GetActivePlayers", "id": 1}')

    if len(activePlayers) > 0:

        del activePlayers[0]['type']
        rpc['params'].update(activePlayers[0])

        if method == 'Player.GoTo':
            rpc['params'].setdefault('to', 'next')

        from json import dumps

        return executeJSONRPC(dumps(rpc))

    return False 
Example #18
Source File: kodiutils.py    From script.module.inputstreamhelper with MIT License 6 votes vote down vote up
def jsonrpc(*args, **kwargs):
    """Perform JSONRPC calls"""
    from json import dumps, loads

    # We do not accept both args and kwargs
    if args and kwargs:
        log(4, 'ERROR: Wrong use of jsonrpc()')
        return None

    # Process a list of actions
    if args:
        for (idx, cmd) in enumerate(args):
            if cmd.get('id') is None:
                cmd.update(id=idx)
            if cmd.get('jsonrpc') is None:
                cmd.update(jsonrpc='2.0')
        return loads(xbmc.executeJSONRPC(dumps(args)))

    # Process a single action
    if kwargs.get('id') is None:
        kwargs.update(id=0)
    if kwargs.get('jsonrpc') is None:
        kwargs.update(jsonrpc='2.0')
    return loads(xbmc.executeJSONRPC(dumps(kwargs))) 
Example #19
Source File: service.py    From xbmc-addons-chinese with GNU General Public License v2.0 5 votes vote down vote up
def get_KodiVersion():
    json_query = xbmc.executeJSONRPC(
        '{ "jsonrpc": "2.0", "method": "Application.GetProperties", "params": {"properties": ["version", "name"]}, "id": 1 }')
    if sys.version_info[0] >= 3:
        json_query = str(json_query)
    else:
        json_query = unicode(json_query, 'utf-8', errors='ignore')
    json_query = json.loads(json_query)
    version_installed = []
    if 'result' in json_query and 'version' in json_query['result']:
        version_installed = json_query['result']['version']
    return version_installed 
Example #20
Source File: log_utils.py    From script.module.resolveurl with GNU General Public License v2.0 5 votes vote down vote up
def execute_jsonrpc(command):
    if not isinstance(command, six.string_types):
        command = json.dumps(command)
    response = xbmc.executeJSONRPC(command)
    return json.loads(response) 
Example #21
Source File: main_module.py    From script.skin.helper.service with GNU General Public License v2.0 5 votes vote down vote up
def togglekodisetting(self):
        '''toggle kodi setting'''
        settingname = self.params.get("setting", "")
        cur_value = getCondVisibility("system.getbool(%s)" % settingname)
        if cur_value:
            new_value = "false"
        else:
            new_value = "true"
        xbmc.executeJSONRPC(
            '{"jsonrpc":"2.0", "id":1, "method":"Settings.SetSettingValue","params":{"setting":"%s","value":%s}}' %
            (settingname, new_value)) 
Example #22
Source File: plugin_content.py    From script.skin.helper.service with GNU General Public License v2.0 5 votes vote down vote up
def alphabetletter(self):
        '''used with the alphabet scrollbar to jump to a letter'''
        if KODI_VERSION > 16:
            xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=False, listitem=xbmcgui.ListItem())
        letter = self.params.get("letter", "").upper()
        jumpcmd = ""
        if letter in ["A", "B", "C", "2"]:
            jumpcmd = "2"
        elif letter in ["D", "E", "F", "3"]:
            jumpcmd = "3"
        elif letter in ["G", "H", "I", "4"]:
            jumpcmd = "4"
        elif letter in ["J", "K", "L", "5"]:
            jumpcmd = "5"
        elif letter in ["M", "N", "O", "6"]:
            jumpcmd = "6"
        elif letter in ["P", "Q", "R", "S", "7"]:
            jumpcmd = "7"
        elif letter in ["T", "U", "V", "8"]:
            jumpcmd = "8"
        elif letter in ["W", "X", "Y", "Z", "9"]:
            jumpcmd = "9"
        if jumpcmd:
            xbmc.executebuiltin("SetFocus(50)")
            for i in range(40):
                xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "method": "Input.ExecuteAction",\
                    "params": { "action": "jumpsms%s" }, "id": 1 }' % (jumpcmd))
                xbmc.sleep(50)
                if xbmc.getInfoLabel("ListItem.Sortletter").upper() == letter:
                    break 
Example #23
Source File: default.py    From script.tv.show.next.aired with GNU General Public License v2.0 5 votes vote down vote up
def check_xbmc_version(self):
        # retrieve current installed version
        json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Application.GetProperties", "params": {"properties": ["version", "name"]}, "id": 1}')
        json_query = unicode(json_query, 'utf-8', errors='ignore')
        json_response = json.loads(json_query)
        log("### %s" % json_response)
        try:
            ver = json_response['result']['version']
            self.xbmc_version = float('%s.%s' % (ver['major'], ver['minor']))
        except:
            self.xbmc_version = 12

        self.videodb = 'videodb://tvshows/titles/' if self.xbmc_version >= 13 else 'videodb://2/2/' 
Example #24
Source File: default.py    From script.tv.show.next.aired with GNU General Public License v2.0 5 votes vote down vote up
def handle_bg_version_change(self, latest_version):
        log("### NextAired version changed from %s to %s -- starting a replacement background proc" % (__version__, latest_version), level=1)
        # Delay a bit, just to be sure that it is ready to run.  We need to also be sure that this
        # is at least as long as the elapsed time we allow in our NextAired.background_id check.
        for cnt in range(15):
            if xbmc.abortRequested:
                sys.exit()
            xbmc.sleep(1000)
        json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Addons.ExecuteAddon", "params": {"addonid": "script.tv.show.next.aired", "params": %s}, "id": 0}' % json.dumps(self.params))
        json_query = unicode(json_query, 'utf-8', errors='ignore')
        json_response = json.loads(json_query)
        log("### %s" % json_response)
        self.close("stopping this older background proc") 
Example #25
Source File: common.py    From xbmc.service.pushbullet with GNU General Public License v3.0 5 votes vote down vote up
def getMainSetting(name):
    result = executeJSONRPC('{ "jsonrpc": "2.0", "method": "Settings.GetSettingValue", "params": {"setting": "' + str(name) + '"}, "id": 1 }')
    return result['value'] 
Example #26
Source File: utils.py    From script.module.clouddrive.common with GNU General Public License v3.0 5 votes vote down vote up
def execute_json_rpc(method, params=None, request_id=1):
        import xbmc
        import json
        cmd = {'jsonrpc': '2.0', 'method': method, 'id': request_id}
        if params:
            cmd['params'] = params
        cmd = json.dumps(cmd)
        return json.loads(xbmc.executeJSONRPC(cmd)) 
Example #27
Source File: default.py    From ru with GNU General Public License v2.0 5 votes vote down vote up
def json_query(query):
	xbmc_request = json.dumps(query)
	result = xbmc.executeJSONRPC(xbmc_request)
	result = unicode(result, 'utf-8', errors='ignore')
	return json.loads(result) 
Example #28
Source File: default.py    From ru with GNU General Public License v2.0 5 votes vote down vote up
def push_string(self, count, line_num):
			        self.string1 = self.process_file()
				self.ac = True
				self.req = json.dumps({"id": "0", "jsonrpc":"2.0", "method":"Input.SendText", "params":{"text":self.string1, "done":self.ac}})
				xbmc.executeJSONRPC(self.req) 
Example #29
Source File: default.py    From ru with GNU General Public License v2.0 5 votes vote down vote up
def execute_addon( params ):
    request = {'jsonrpc': '2.0',
               'method': 'Addons.ExecuteAddon',
               'params': {'addonid': plugin.id,
                          'params': params,
                          'wait': False},
                'id': 1
               }
    response = xbmc.executeJSONRPC(json.dumps(request)) 
Example #30
Source File: service.py    From xbmc-addons-chinese with GNU General Public License v2.0 5 votes vote down vote up
def get_KodiVersion():
    json_query = xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "method": "Application.GetProperties", "params": {"properties": ["version", "name"]}, "id": 1 }')
    if sys.version_info[0] >= 3:
        json_query = str(json_query)
    else:
        json_query = unicode(json_query, 'utf-8', errors='ignore')
    json_query = json.loads(json_query)
    version_installed = []
    if 'result' in json_query and 'version' in json_query['result']:
        version_installed  = json_query['result']['version']
    return version_installed