Integrations often need one field deep inside an API response. Implement get_path(data, path, default)
where path is dotted with optional list indexes, e.g. items[0].metadata.name or a.b[2][1].
Return default if any step is missing: a key that doesn't exist, an index out of range, or indexing
into the wrong type. An empty path returns data itself.
Implement get_path. Input: data: any JSON value, path: str, default: any. Returns: the value at the path, or default.
def get_path(data, path: str, default=None):
return default
Run executes the public tests. Submit grades against public and hidden tests.
Integrations often need one field deep inside an API response. Implement get_path(data, path, default)
where path is dotted with optional list indexes, e.g. items[0].metadata.name or a.b[2][1].
Return default if any step is missing: a key that doesn't exist, an index out of range, or indexing
into the wrong type. An empty path returns data itself.
Implement get_path. Input: data: any JSON value, path: str, default: any. Returns: the value at the path, or default.
def get_path(data, path: str, default=None):
return default
Run executes the public tests. Submit grades against public and hidden tests.