Can I get remote server's ip address via response?
For some reason. I'll need get remote site's ip address when parsing response. I looked the document but found nothing.
Any one know that?
Thanks!
The text was updated successfully, but these errors were encountered:
You could use the url property of the Response object, pass it to urllib.parse.urlparse fuction to obtain the domain name. Then you can pass the domain to socket.gethostbyname to get the IP address. I haven't tested it, but it should work.
I think Stack Overflow is a better place to ask questions of this kind than GitHub. GitHub's issue tracker is primarily for bug reports and feature requests.
Thanks @anubhavp28 .
I don't think it is the right way to get remote ip in scrapy
get_host_by_name cause another new dns resolve. Actually we've got remote ip in scrapy.
class CrawlerProcess has an built-in dnscache object but we can not get it in pipeline.
Can I get remote server's ip address via response?
For some reason. I'll need get remote site's ip address when parsing response. I looked the document but found nothing.
Any one know that?
Thanks!
The text was updated successfully, but these errors were encountered: