def validate_capi_content()

in gnm_deliverables/views/deliverables_dash_views.py [0:0]


    def validate_capi_content(capi_content: dict):
        """
        checks if the passed dictionary has the keys we need to treat it as a capi record
        :param capi_content:
        :return: the contents of the response.content keys if it's valid or None if its not.
        """
        if "response" not in capi_content or "content" not in capi_content["response"]:
            return None

        if "atoms" not in capi_content["response"]["content"] or "media" not in capi_content["response"]["content"]["atoms"]:
            return None

        if not isinstance(capi_content["response"]["content"]["atoms"]["media"], list):
            return None

        return capi_content["response"]["content"]