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
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
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
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)
def user_agent(self): # Pass in an index to random_user_agent() to test with a particular # user agent return random_user_agent()
def user_agent(self): return random_user_agent(allow_ie=False)
def get_browser(): global _lt_br if _lt_br is None: _lt_br = browser(user_agent=random_user_agent()) return _lt_br.clone_browser()
def get_browser(self) -> mechanize.Browser: browser = calibre_browser(user_agent=random_user_agent(allow_ie=False)) browser.addheaders += [("Accept", "*/*")] return browser