Issue
When you run the following code on Google:
response.ip_address
Her values equal to:
IPv4Address('79.127.127.87')
But the expected answer is as follows:
'79.127.127.87'
How to get this answer?
Solution
Just use str():
scrapy shell
In [1]: url='https://httpbin.org/'
In [2]: req = scrapy.Request(url=url)
In [3]: fetch(req)
[scrapy.core.engine] INFO: Spider opened
[scrapy.core.engine] DEBUG: Crawled (200) <GET https://httpbin.org/> (referer: None)
In [4]: str(response.ip_address)
Out[4]: '3.93.133.228'
Answered By - SuperUser
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.