import json


def parse_api_response_body(response_body):
    author_info = {}
    answers_info = []
    rsp_obj = json.loads(response_body)
    if 'data' in rsp_obj:
        data = rsp_obj['data']
        for item in data:
            answer = {}
            for key in item:
                if key == 'author':
                    if len(author_info) == 0:
                        author_info = item['author']
                else:
                    answer[key] = item[key]
            answers_info.append(answer)
    return author_info, answers_info


if __name__ == '__main__':
    test_file = open('./test_data', 'r', encoding='utf-8')
    test_data = test_file.read()
    test_file.close()
    author, answers = parse_api_response_body(test_data)
    pass
