mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-02-24 16:49:56 -05:00
Merge pull request #148 from vbanos/disk-cache
Add disk cache options to Chrome
This commit is contained in:
commit
7d5bb4b5d4
@ -134,7 +134,8 @@ class Chrome:
|
|||||||
cookie_location, exc_info=True)
|
cookie_location, exc_info=True)
|
||||||
return cookie_db
|
return cookie_db
|
||||||
|
|
||||||
def start(self, proxy=None, cookie_db=None):
|
def start(self, proxy=None, cookie_db=None, disk_cache_dir=None,
|
||||||
|
disk_cache_size=None):
|
||||||
'''
|
'''
|
||||||
Starts chrome/chromium process.
|
Starts chrome/chromium process.
|
||||||
|
|
||||||
@ -144,7 +145,10 @@ class Chrome:
|
|||||||
which, if supplied, will be written to
|
which, if supplied, will be written to
|
||||||
{chrome_user_data_dir}/Default/Cookies before running the
|
{chrome_user_data_dir}/Default/Cookies before running the
|
||||||
browser (default None)
|
browser (default None)
|
||||||
|
disk_cache_dir: use directory for disk cache. The default location
|
||||||
|
is inside `self._home_tmpdir` (default None).
|
||||||
|
disk_cache_size: Forces the maximum disk space to be used by the disk
|
||||||
|
cache, in bytes. (default None)
|
||||||
Returns:
|
Returns:
|
||||||
websocket url to chrome window with about:blank loaded
|
websocket url to chrome window with about:blank loaded
|
||||||
'''
|
'''
|
||||||
@ -166,12 +170,17 @@ class Chrome:
|
|||||||
'--disable-background-networking',
|
'--disable-background-networking',
|
||||||
'--disable-renderer-backgrounding', '--disable-hang-monitor',
|
'--disable-renderer-backgrounding', '--disable-hang-monitor',
|
||||||
'--disable-background-timer-throttling', '--mute-audio',
|
'--disable-background-timer-throttling', '--mute-audio',
|
||||||
'--disable-web-sockets', '--disable-cache',
|
'--disable-web-sockets',
|
||||||
'--window-size=1100,900', '--no-default-browser-check',
|
'--window-size=1100,900', '--no-default-browser-check',
|
||||||
'--disable-first-run-ui', '--no-first-run',
|
'--disable-first-run-ui', '--no-first-run',
|
||||||
'--homepage=about:blank', '--disable-direct-npapi-requests',
|
'--homepage=about:blank', '--disable-direct-npapi-requests',
|
||||||
'--disable-web-security', '--disable-notifications',
|
'--disable-web-security', '--disable-notifications',
|
||||||
'--disable-extensions', '--disable-save-password-bubble']
|
'--disable-extensions', '--disable-save-password-bubble']
|
||||||
|
|
||||||
|
if disk_cache_dir:
|
||||||
|
chrome_args.append('--disk-cache-dir=%s' % disk_cache_dir)
|
||||||
|
if disk_cache_size:
|
||||||
|
chrome_args.append('--disk-cache-size=%s' % disk_cache_size)
|
||||||
if self.ignore_cert_errors:
|
if self.ignore_cert_errors:
|
||||||
chrome_args.append('--ignore-certificate-errors')
|
chrome_args.append('--ignore-certificate-errors')
|
||||||
if proxy:
|
if proxy:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user