list indices must be integers or slices, not str python3.6 list indices must be integers or slices, not str python3.6 json json

list indices must be integers or slices, not str python3.6


Your problem is with the lines:

host_tags = instance.tagsprint(host_tags['Key']['email']['Value'])

Rewrite it like this:

host_tags = instance.tagsfor tag in host_tags:    print('Key: ' + tag['Key'] + ' Value: ' + tag['Value'])

instance.tags is an array of dict. You need to process each item (tag) in the array. Then you need to process the dict extracting its key / value pairs.