whois/__init__.py
changeset 86 d6fcfa5acc7b
parent 73 644d81a7995b
child 98 3202436d89d0
--- a/whois/__init__.py	Thu Jun 02 13:37:33 2016 -0700
+++ b/whois/__init__.py	Thu Jun 02 13:56:11 2016 -0700
@@ -19,6 +19,12 @@
     ip_match = re.match(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$", url)
     if ip_match:
         domain = url
+        try:
+            result = socket.gethostbyaddr(url)
+        except socket.herror as e:
+            pass
+        else:
+            domain = result[0]
     else:
         domain = extract_domain(url)
     if command: