Skip to content

Commit 584252e

Browse files
committed
move AutoThrottle default options to default_settings.py
1 parent e6272e5 commit 584252e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

scrapy/extensions/throttle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ def _min_delay(self, spider):
3333
s.getfloat('DOWNLOAD_DELAY')
3434

3535
def _max_delay(self, spider):
36-
return self.crawler.settings.getfloat('AUTOTHROTTLE_MAX_DELAY', 60.0)
36+
return self.crawler.settings.getfloat('AUTOTHROTTLE_MAX_DELAY')
3737

3838
def _start_delay(self, spider):
39-
return max(self.mindelay, self.crawler.settings.getfloat('AUTOTHROTTLE_START_DELAY', 5.0))
39+
return max(self.mindelay, self.crawler.settings.getfloat('AUTOTHROTTLE_START_DELAY'))
4040

4141
def _response_downloaded(self, response, request, spider):
4242
key, slot = self._get_slot(request, spider)

scrapy/settings/default_settings.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121
AJAXCRAWL_ENABLED = False
2222

23+
AUTOTHROTTLE_ENABLED = False
24+
AUTOTHROTTLE_DEBUG = False
25+
AUTOTHROTTLE_MAX_DELAY = 60.0
26+
AUTOTHROTTLE_START_DELAY = 5.0
27+
2328
BOT_NAME = 'scrapybot'
2429

2530
CLOSESPIDER_TIMEOUT = 0

0 commit comments

Comments
 (0)