title: How to use http and https proxy together in scrapy?
body: <p>I am new in scrapy. I found that for use http proxy but I want to use http and https proxy together because when I crawl the links there has http and https links. How do I use also http and https proxy?</p>
  
  <pre><code>class ProxyMiddleware(object):
      def process_request(self, request, spider):
          request.meta['proxy'] = "http://YOUR_PROXY_IP:PORT"
          #like here request.meta['proxy'] = "https://YOUR_PROXY_IP:PORT"
          proxy_user_pass = "USERNAME:PASSWORD"
          # setup basic authentication for the proxy
          encoded_user_pass = base64.encodestring(proxy_user_pass)
          request.headers['Proxy-Authorization'] = 'Basic ' + encoded_user_pass
  </code></pre>