Pass "i" variable by json-rpc to python script

Hi Guys,

I want to be able to pass a variable like i=1199 by json-rpc to python script in another user.

I have this json-rpc and can activate an the python script in another user:

import requests
import xbmc
import xbmcgui
import xbmcplugin
import xbmcaddon

headers = {
    'Content-Type': 'application/json',
}

data = '''{
    "jsonrpc":"2.0",
    "method":"Addons.ExecuteAddon",
    "params": {
        "addonid":"script.activatewindowid",
        "params": {
            "i":"1199"
        }
    },
    "id":1
}'''

response = requests.post('http://192.168.1.200:8080/jsonrpc',
    headers=headers,
    data=data,
    auth=('kodi', '1234'))

but I need to pass variable or arguments like i=“1199” to work in python script like this:

import xbmc
import xbmcgui
import xbmcplugin
import xbmcaddon
 
i = "i"
 
if i == "1199":
    xbmc.executebuiltin('ActivateWindow(9000)')
else:
    xbmc.executebuiltin('ActivateWindow(1199)')

Sorry but I am still beginner in json-rpc and python

Thanks for all

Hi @mohammadsaeed01,

Just curious, what are you working on and how does it relate to Rhino?

Thanks,

– Dale

Hi @dale

Sorry if not related in Rhino! but I am working in Kodi xbmc and want to pass variables from json-rpc and let python to read it and use it in it’s if statement!

Sorry if I am in wrong forum:slightly_smiling_face: but would be appreciated if you helped me :hugs:

Thanks

Hi @mohammadsaeed01,

Sorry - you’ll need to find another forum for assistance.

– Dale