I am trying to pass a YAML file into a python script that compares the YAML file to a list of key:value pairs grabbed from an API.
YAML file
required_tags:
environment:
- "dev"
- "qa"
owner:
- "*"
key:values from API
{
"environment": "prod",
"owner": "billy"
}
So I am trying to say, if the key:values from the API don't match any of the required_tags from the YAML file, send a message with the key:value pair that's wrong. So in this case, "environment": "prod" does not match any of the "environment" values from the required_tags section, so I would like to print the violating key:value pair. I was thinking perhaps I have to generate a list of key:values from the YAML first to make them consistent with the data structure of the API call? So the YAML would look more like this?
{
"environment":"dev",
"environment":"qa",
"owner":"*"
}
Still new to some of the dictionary/tuple stuff, so any help would be appreciated.