Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def lookup(self, ip_address):
"""Try to do a reverse dns lookup on the given ip_address"""
# Is this already in our cache
if self.ip_lookup_cache.get(ip_address):
domain = self.ip_lookup_cache.get(ip_address)
# Is the ip_address local or special
elif not self.lookup_internal and net_utils.is_internal(ip_address):
domain = 'internal'
elif net_utils.is_special(ip_address):
domain = net_utils.is_special(ip_address)
# Look it up at this point
else:
domain = self._reverse_dns_lookup(ip_address)
# Cache it
self.ip_lookup_cache.set(ip_address, domain)
# Return the domain
return domain
def lookup(self, ip_address):
"""Try to do a reverse dns lookup on the given ip_address"""
# Is this already in our cache
if self.ip_lookup_cache.get(ip_address):
domain = self.ip_lookup_cache.get(ip_address)
# Is the ip_address local or special
elif not self.lookup_internal and net_utils.is_internal(ip_address):
domain = 'internal'
elif net_utils.is_special(ip_address):
domain = net_utils.is_special(ip_address)
# Look it up at this point
else:
domain = self._reverse_dns_lookup(ip_address)
# Cache it
self.ip_lookup_cache.set(ip_address, domain)
# Return the domain
return domain