How to use the socli.socli.Header function in socli

To help you get started, we’ve selected a few socli examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gautamkrishnar / socli / socli / socli.py View on Github external
global question_post
            if self.cachedQuestions[index] != None:
                question_post = self.cachedQuestions[index]
                LOOP.widget = question_post
            else:
                if not google_search:
                    url = sourl + url
                question_title, question_desc, question_stats, answers = get_question_stats_and_answer(url)
                question_post = QuestionPage((answers, question_title, question_desc, question_stats, url))
                self.cachedQuestions[index] = question_post
                LOOP.widget = question_post

    global header_for_display
    global question_page
    global LOOP
    header_for_display = Header()

    try:
        if google_search:
            questions = get_questions_for_query_google(query)
        else:
            questions = get_questions_for_query(query)
        question_page = SelectQuestionPage(questions)
        LOOP = EditedMainLoop(question_page, palette)
        LOOP.run()

    except UnicodeEncodeError:
        print_warning("\n\nEncoding error: Use \"chcp 65001\" command before using socli...")
        sys.exit(0)
    except requests.exceptions.ConnectionError as e:
        print_fail("Please check your internet connectivity...")
    except Exception as e:
github gautamkrishnar / socli / socli / socli.py View on Github external
def dispres(url):
    """
    Display result page
    :param url: URL of the search result
    :return:
    """
    global question_post
    global header_for_display
    global LOOP
    randomheaders()
    res_page = requests.get(url, headers=header)
    captchacheck(res_page.url)
    header_for_display = Header()
    question_title, question_desc, question_stats, answers = get_question_stats_and_answer(url)
    question_post = QuestionPage((answers, question_title, question_desc, question_stats, url))
    LOOP = EditedMainLoop(question_post, palette)
    LOOP.run()