Scrapy, a fast high-level web crawling & scraping framework for Python.
[MRG+1] change the bad smell code (#3304)
Grammy Jiangd05c8677c507
diff --git a/scrapy/downloadermiddlewares/httpproxy.py b/scrapy/downloadermiddlewares/httpproxy.pyindex 0d5320bf8..1dd47359f 100644--- a/scrapy/downloadermiddlewares/httpproxy.py+++ b/scrapy/downloadermiddlewares/httpproxy.py@@ -1,14 +1,13 @@import base64+from six.moves.urllib.parse import unquote, urlunparsefrom six.moves.urllib.request import getproxies, proxy_bypass-from six.moves.urllib.parse import unquotetry:from urllib2 import _parse_proxyexcept ImportError:from urllib.request import _parse_proxy-from six.moves.urllib.parse import urlunparse-from scrapy.utils.httpobj import urlparse_cachedfrom scrapy.exceptions import NotConfigured+from scrapy.utils.httpobj import urlparse_cachedfrom scrapy.utils.python import to_bytes@@ -17,8 +16,8 @@ class HttpProxyMiddleware(object):def __init__(self, auth_encoding='latin-1'):self.auth_encoding = auth_encodingself.proxies = {}- for type, url in getproxies().items():- self.proxies[type] = self._get_proxy(url, type)+ for type_, url in getproxies().items():+ self.proxies[type_] = self._get_proxy(url, type_)@classmethoddef from_crawler(cls, crawler):