whois/__init__.py
changeset 25 f3c0a9a442aa
parent 23 5c3e1a2c9c9a
child 29 1ebe960587b1
--- a/whois/__init__.py	Wed Mar 05 15:41:49 2014 -0500
+++ b/whois/__init__.py	Fri Mar 21 12:09:00 2014 -0400
@@ -8,7 +8,11 @@
 
 def whois(url):
     # clean domain to expose netloc
-    domain = extract_domain(url)
+    ip_match = re.match(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$", url)
+    if ip_match:
+        domain = url
+    else:
+        domain = extract_domain(url)
     try:
         # try native whois command first
         r = subprocess.Popen(['whois', domain], stdout=subprocess.PIPE)