Your question is Parse API JSON Response. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Implement a function parse_api_response(status_code, payload) that processes an API response for a mobile client. The input is an integer HTTP-like status_code and a JSON string payload. If status_code is not 200, return an empty list. Otherwise, parse the JSON and return a list of model dictionaries from the rides array. Each returned model must contain only id, driver_name, and eta_minutes. Skip any ride object missing one of those fields or having invalid types.
rides, or may contain malformed ride objectsdef parse_api_response(status_code, payload):