Пример #1
0
def browser():
    ua = random_user_agent(allow_ie=False)
    br = _browser(user_agent=ua)
    br.set_handle_gzip(True)
    br.addheaders += [
        ('Accept', accept_header_for_ua(ua)),
        ('Upgrade-insecure-requests', '1'),
    ]
    return br
Пример #2
0
def browser():
    ua = random_user_agent(allow_ie=False)
    br = _browser(user_agent=ua)
    br.set_handle_gzip(True)
    br.addheaders += [
        ('Accept', accept_header_for_ua(ua)),
        ('Upgrade-insecure-requests', '1'),
    ]
    return br
Пример #3
0
def browser():
    ua = random_user_agent(allow_ie=False)
    # ua = 'Mozilla/5.0 (Linux; Android 8.0.0; VTR-L29; rv:63.0) Gecko/20100101 Firefox/63.0'
    br = _browser(user_agent=ua)
    br.set_handle_gzip(True)
    br.addheaders += [
        ('Accept', accept_header_for_ua(ua)),
        ('Upgrade-insecure-requests', '1'),
    ]
    return br
Пример #4
0
def browser():
    ua = random_user_agent(allow_ie=False)
    # ua = 'Mozilla/5.0 (Linux; Android 8.0.0; VTR-L29; rv:63.0) Gecko/20100101 Firefox/63.0'
    br = _browser(user_agent=ua)
    br.set_handle_gzip(True)
    br.addheaders += [
        ('Accept', accept_header_for_ua(ua)),
        ('Upgrade-insecure-requests', '1'),
    ]
    return br
Пример #5
0
def create_profile():
    ans = getattr(create_profile, 'ans', None)
    if ans is None:
        ans = QWebEngineProfile('viewer-lookup', QApplication.instance())
        ans.setHttpUserAgent(random_user_agent(allow_ie=False))
        ans.setCachePath(os.path.join(cache_dir(), 'ev2vl'))
        js = P('lookup.js', data=True, allow_user_override=False)
        insert_scripts(ans, create_script('lookup.js', js))
        s = ans.settings()
        s.setDefaultTextEncoding('utf-8')
        create_profile.ans = ans
    return ans
Пример #6
0
 def __init__(self, data):
     MainWindow.__init__(self, None)
     self.setWindowIcon(QIcon(I('store.png')))
     self.setWindowTitle(data['window_title'])
     self.download_data = {}
     profile = QWebEngineProfile.defaultProfile()
     profile.setCachePath(os.path.join(cache_dir(), 'web_store', 'hc'))
     profile.setPersistentStoragePath(os.path.join(cache_dir(), 'web_store', 'ps'))
     profile.setHttpUserAgent(random_user_agent(allow_ie=False))
     profile.downloadRequested.connect(self.download_requested)
     self.data = data
     self.central = c = Central(self)
     c.home.connect(self.go_home)
     self.setCentralWidget(c)
     geometry = gprefs.get('store_dialog_main_window_geometry')
     if geometry is not None:
         self.restoreGeometry(geometry)
     self.go_to(data['detail_url'] or None)
Пример #7
0
 def user_agent(self):
     # Pass in an index to random_user_agent() to test with a particular
     # user agent
     return random_user_agent()
Пример #8
0
 def user_agent(self):
     # Pass in an index to random_user_agent() to test with a particular
     # user agent
     return random_user_agent()
Пример #9
0
 def user_agent(self):
     return random_user_agent(allow_ie=False)
Пример #10
0
def get_browser():
    global _lt_br
    if _lt_br is None:
        _lt_br = browser(user_agent=random_user_agent())
    return _lt_br.clone_browser()
Пример #11
0
 def user_agent(self):
     return random_user_agent(allow_ie=False)
Пример #12
0
def get_browser():
    global _lt_br
    if _lt_br is None:
        _lt_br = browser(user_agent=random_user_agent())
    return _lt_br.clone_browser()
Пример #13
0
 def get_browser(self) -> mechanize.Browser:
     browser = calibre_browser(user_agent=random_user_agent(allow_ie=False))
     browser.addheaders += [("Accept", "*/*")]
     return browser