Oct-28-2019, 12:58 PM
I have a list of dictionaries, each dictionary contains keys relating to its health.
I am creating the list via the following as I don't want ever key in the dictionary.
[
{
"associatedPerson": {
"viaLogin": "user"
},
"encryption": {
"volumes": [
{
"status": "notEncrypted",
"volumeId": "60BB3F30"
}
]
},
"health": {
"overall": "good",
"services": {
"serviceDetails": [
{
"name": "service",
"status": "running"
},
The issue I am having is, Health will return the dictionary below it. I just need the overall key, not all others. How can I do this?
I am creating the list via the following as I don't want ever key in the dictionary.
computer_keys = ('id', 'hostname', 'lastSeenAt', 'threats', 'ProtectionEnabled', 'services', 'ipv4Addresses', 'associatedPerson', 'health') for all_computers in computers_json["items"]: computer_dictionary = {key:value for key, value in all_computers.items() if key in computer_keys} computer_list.append(computer_dictionary)The list looks like this
[
{
"associatedPerson": {
"viaLogin": "user"
},
"encryption": {
"volumes": [
{
"status": "notEncrypted",
"volumeId": "60BB3F30"
}
]
},
"health": {
"overall": "good",
"services": {
"serviceDetails": [
{
"name": "service",
"status": "running"
},
The issue I am having is, Health will return the dictionary below it. I just need the overall key, not all others. How can I do this?