def main():
    """
    Get all questions, for each question get all the answers.
    :return:
    """

    print '|Getting questions from Stackoverflow. Please wait...|'
    items = list()
    questions = get_questions()
    print '|Total questions: {} |'.format(len(questions))
    if questions:
        for question in questions:
            formatter = Formatter()
            question.body = get_question_body(question.id)
            question.body_clean = formatter.beautify(question.body)
            question.answers = get_answers(question.id)             # Iterate over each question and get all answers

    print '|Display information'
    for question in questions:
        item = Item()
        if question.title and question.body_clean:
            item.text = question.title + ' ' + question.body_clean

        if question.answers:
            for answer in question.answers:
                item.text += ' ' + answer.body_clean
                item.text.rstrip('\r\n')
        items.append(item)
        print '<<'
        print item.text
def process_answer_items(content, beautify=True):
    """
    Process response and generate dictionary with questions and URL
    :param content:
    :param beautify:
    :return:
    """
    answers = list()
    if "items" in content:
        items = content["items"]
        for item in items:
            answer = Answer()
            answer.id = item['answer_id']
            answer.body = item['body']
            answer.is_accepted = item['is_accepted']
            if beautify:
                formatter = Formatter()
                answer.body_clean = formatter.beautify(answer.body)
            answers.append(answer)
    return answers