I have a Python code that connects to MongoDB and extracts data - when I print the same I get the below output:
data = db.collection.aggregate(...)
for d in data:
ip = d['_id']
print d , ip
{u'count': 125391, u'_id': u'11.11.11.111'} 11.11.11.111
{u'count': 994883, u'_id': u'11.11..11.112'} 11.11..11.112
..............................................
But when I try to get the hostname for the IP listed in each records I get the below error:
name,alias,addresslist = socket.gethostbyaddr(ip)
Traceback (most recent call last):
File "./myprog.py", line 51, in <module>
name,alias,addresslist = socket.gethostbyaddr(ip)
socket.herror: [Errno 0] Resolver Error 0 (no error)