From 32b4d4edf13c601fd6aa1cde0b7e2f33b170997d Mon Sep 17 00:00:00 2001 From: Akash Manohar Date: Fri, 25 Nov 2016 20:24:22 +0530 Subject: [PATCH] Check for PROXY_LIST only if not CUSTOM_PROXY mode --- scrapy_proxies/randomproxy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scrapy_proxies/randomproxy.py b/scrapy_proxies/randomproxy.py index aedc4ab..d4507fa 100644 --- a/scrapy_proxies/randomproxy.py +++ b/scrapy_proxies/randomproxy.py @@ -35,10 +35,10 @@ def __init__(self, settings): self.mode = settings.get('PROXY_MODE') self.proxy_list = settings.get('PROXY_LIST') self.chosen_proxy = '' - if self.proxy_list is None: - raise KeyError('PROXY_LIST setting is missing') if self.mode == Mode.RANDOMIZE_PROXY_EVERY_REQUESTS or self.mode == Mode.RANDOMIZE_PROXY_ONCE: + if self.proxy_list is None: + raise KeyError('PROXY_LIST setting is missing') fin = open(self.proxy_list) self.proxies = {} for line in fin.readlines():