diff options
Diffstat (limited to 'crocoite')
-rw-r--r-- | crocoite/cli.py | 6 | ||||
-rw-r--r-- | crocoite/defaults.py | 27 | ||||
-rw-r--r-- | crocoite/warc.py | 6 |
3 files changed, 34 insertions, 5 deletions
diff --git a/crocoite/cli.py b/crocoite/cli.py index 86fee13..2cbbfa8 100644 --- a/crocoite/cli.py +++ b/crocoite/cli.py @@ -31,7 +31,7 @@ from urllib.parse import urlsplit from celery import Celery from celery.utils.log import get_task_logger -from . import behavior +from . import behavior, defaults from .warc import WarcLoader, SerializingWARCWriter from .browser import ChromeService, NullService from .util import packageUrl, getFormattedViewportMetrics @@ -137,8 +137,8 @@ def main (): parser.add_argument('--distributed', help='Use celery worker', action='store_true') parser.add_argument('--timeout', default=10, type=int, help='Maximum time for archival', metavar='SEC') parser.add_argument('--idle-timeout', default=2, type=int, help='Maximum idle seconds (i.e. no requests)', dest='idleTimeout', metavar='SEC') - parser.add_argument('--log-buffer', default=1000, type=int, dest='logBuffer', metavar='LINES') - parser.add_argument('--max-body-size', default=10*1024*1024, type=int, dest='maxBodySize', help='Max body size', metavar='BYTES') + parser.add_argument('--log-buffer', default=defaults.logBuffer, type=int, dest='logBuffer', metavar='LINES') + parser.add_argument('--max-body-size', default=defaults.maxBodySize, type=int, dest='maxBodySize', help='Max body size', metavar='BYTES') #parser.add_argument('--keep-tab', action='store_true', default=False, dest='keepTab', help='Keep tab open') parser.add_argument('--behavior', help='Comma-separated list of enabled behavior scripts', dest='enabledBehaviorNames', diff --git a/crocoite/defaults.py b/crocoite/defaults.py new file mode 100644 index 0000000..d55312d --- /dev/null +++ b/crocoite/defaults.py @@ -0,0 +1,27 @@ +# Copyright (c) 2017 crocoite contributors +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +""" +Defaults settings +""" + +maxBodySize = 50*1024*1024 +logBuffer = 1000 + diff --git a/crocoite/warc.py b/crocoite/warc.py index 540f673..e04bee4 100644 --- a/crocoite/warc.py +++ b/crocoite/warc.py @@ -40,6 +40,7 @@ from warcio.warcwriter import WARCWriter from .browser import AccountingSiteLoader from .util import packageUrl +from . import defaults class SerializingWARCWriter (WARCWriter): """ @@ -103,8 +104,9 @@ class WARCLogHandler (BufferingHandler): class WarcLoader (AccountingSiteLoader): def __init__ (self, browser, url, writer, - logger=logging.getLogger(__name__), logBuffer=1000, - maxBodySize=10*1024*1024): + logger=logging.getLogger(__name__), + logBuffer=defaults.logBuffer, + maxBodySize=defaults.maxBodySize): super ().__init__ (browser, url, logger) self.writer = writer self.maxBodySize = maxBodySize |