Open ravillarreal opened 6 years ago
I made a test with this middleware : without proxy_user_pass
(I don't have one to test with), proxy is not used :
import scrapy
class MyipSpider(scrapy.Spider):
name = 'myip'
start_urls = ['http://www.mon-ip.com]
def parse(self, response):
for in in response.xpath('//*[@id="PageG"]'):
yield {
'ip': ip.xpath('p[3]/span[2]//text()').extract_first(),
}
gives :
2018-08-28 15:17:10 [scrapy.proxies] DEBUG : Using proxy <https://pro.xy.add.ress:port>, x proxies left [...] 2018-08-28 15:17:10 [scrapy.core.scraper] DEBUG : Scraped from <200 http://www.mon-ip.com> {'ip': 'my.ip.add.ress'}
This change works : https://github.com/aivarsk/scrapy-proxies/pull/43/files
bump on schizophrene's PR. I was able to use that change and verify that my requests were indeed using a proxy's IP and not my own local IP.
In the
process_request
function the proxy is passed to the request only if has anproxy_user_pass
, otherwise only print that the proxy is beign used and which are left. That means that a proxy likehttps://176.37.14.252:8080
does not work?This is the function: