I started to use ProxyMesh with Scrapy. ProxyMesh is supposed to provide a pool of IP addresses on one port. The sample code code below is being repeated in a loop, middleware is enabled and overall this works fine. Can I track (and if so - how?) which IP address is being used for each specific request?
request = scrapy.Request(producturl, self.parse_product_info)
request.meta['proxy'] = 'http://uk.proxymesh.com:xxx'
yield request
I found similar posts on SOF, but not addressing this specific question.
Like specified in the comments, the information comes on the response headers, just check it:
def parse_response(self, response):
print response.headers
You should see the X-Proxymesh-Ip
header with the assigned proxy.
Another alternative could be to use crawlera which offers even more features (like headers, sessions and cookie handling) and better documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With