def select_question(self, url, index): if self.cachedQuestions[index] is not None: tui.question_post = self.cachedQuestions[index] tui.MAIN_LOOP.widget = tui.question_post else: if not search.google_search: url = search.so_url + url question_title, question_desc, question_stats, answers = search.get_question_stats_and_answer(url) question_post = tui.QuestionPage((answers, question_title, question_desc, question_stats, url)) self.cachedQuestions[index] = question_post tui.MAIN_LOOP.widget = question_post
def display_results(url): """ Display result page :param url: URL of the search result :return: """ search.random_headers() res_page = requests.get(url, headers=search.header) search.captcha_check(res_page.url) tui.display_header = tui.Header() question_title, question_desc, question_stats, answers = search.get_question_stats_and_answer(url) tui.question_post = tui.QuestionPage((answers, question_title, question_desc, question_stats, url)) tui.MAIN_LOOP = tui.EditedMainLoop(tui.question_post, palette) tui.MAIN_LOOP.run()
def test07_searchStats(self): try: _search.get_question_stats_and_answer(self.surl) except Exception: raise SoCLITestingException("Search SO stats test failed.")