v17 Issue getting nested dictionary value in addon, but no issue outside of kodi
#1
I'm using the Requests library to make api calls. So far I've had no issues getting all the values I need, until now. I'm trying to obtain a value inside a nested dictionary object. Below is the code I'm using. My end goal is to list the author's name and timestamp in the details container next to the itemlist. Just like this Add-on screen view (right-hand side description/info)

image removed

For testing I've been trying to get the pull request author's name, but for some reason I can't seem to get it inside the addon code. Outside of the addon code (testing in EventGhost using Python Script action) I can get the value fine both ways that I try below.

Code:
link = 'https://api.github.com/repos/caffeinatedMike/testing/pulls'
HEADERS = {'user-agent':'test-account'}

r = requests.get(link,headers=HEADERS)
    if r.status_code == 200:
        j_obj = json.loads(r.text)
        if not len(j_obj) == 0:
            for pull in j_obj:
            
                #Attempt 1) author = pull['user']['login']
                #Attempt 2) author = pull['user'].get('login')
                xbmc.executebuiltin('Notification(%s, %s, %d, %s)'%(addonname, author, time, icon))
                
                list_item = xbmcgui.ListItem(label=pull['title'], artist=author)

The first issue with the code is I'm not able to get the author value from the response. Usually it's giving me "Key doesn't exist" or something about indices. The second issue is Kodi through another error saying that artist isn't a valid parameter. Does this have anything to do with the fact that the addon I'm working on is a program addon and not a video addon?

Any help and/or advice would be greatly appreciated.

Github Pull Request Api page for reference.
Quote:pro·gram·mer (n): An organism capable of converting caffeine into code.
Reply
#2
Your posted image features banned addons (wiki) repos and is not acceptable here as it violates our forum rules (wiki). It had been removed.

Please read the links in detail or future posts and threads will be removed completely.

That also moved to addon development
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply

Logout Mark Read Team Forum Stats Members Help
Issue getting nested dictionary value in addon, but no issue outside of kodi0