[mythtv-users] services API question

George Bingham georgeb1962 at gmail.com
Thu Feb 23 20:14:02 UTC 2023

Hello List folk,

This question may not be appropriate for this forum, so please redirect me
if there's a better way to get this answered....

I'm playing with some python code to get guide data similar to what mythweb
does with the guide. Although I'm only interested in a subset of the full
guide data.

Anyway, I am using the Channel Service 'GetChannelInfoList' and am trying
to loop my way through it to see the chanId, chanNum, CallSign.

The data structures that most of these service api requests result in is
confusing to me. How do I know what's a dictionary and what's a list? When
it's a dictionary, how do I know what the keys are?
Here's an example of a loop where I'm trying to traverse the results...
This isn't part of any actual project yet, I'm just trying to understand
how to examine and use the results of these queries...

    print ("Response from channel Info query: ", resp_dict)
    for chan in channelInfos:
        print(channelInfos[c]['ChanID'], channelInfos[c]['ChanNum'],

The print command in the for loop is generating an error, "KeyError: 0"
But I used to have the 'chan' from the for loop there and it was giving me
an error about indices must be integers, not strings, so I'm not sure if
it's a list or a dict or what the heck it is...

How is one supposed to determine the structures of data that are returned
by the service api calls???

Thanks for any insight!!
-- George
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20230223/6fd2da97/attachment.htm>

More information about the mythtv-users mailing list