added support for org.uk
authorRichard Baron Penman
Tue, 08 Jan 2013 16:27:34 +1100
changeset 10 169462701583
parent 9 6d18568e986d
child 11 5083c26d8f93
added support for org.uk
pywhois/__init__.py
pywhois/parser.py
--- a/pywhois/__init__.py	Tue Jan 08 16:21:26 2013 +1100
+++ b/pywhois/__init__.py	Tue Jan 08 16:27:34 2013 +1100
@@ -17,6 +17,7 @@
         # try experimental client
         nic_client = NICClient()
         text = nic_client.whois_lookup(None, domain, 0)
+    print text
     return WhoisEntry.load(domain, text)
 
 
--- a/pywhois/parser.py	Tue Jan 08 16:21:26 2013 +1100
+++ b/pywhois/parser.py	Tue Jan 08 16:27:34 2013 +1100
@@ -94,27 +94,27 @@
         if text.strip() == 'No whois server is known for this kind of object.':
             raise PywhoisError(text)
 
-        if '.com' in domain:
+        if domain.endswith('.com'):
             return WhoisCom(domain, text)
-        elif '.net' in domain:
+        elif domain.endswith('.net'):
             return WhoisNet(domain, text)
-        elif '.org' in domain:
+        elif domain.endswith('.org'):
             return WhoisOrg(domain, text)
-        elif '.ru' in domain:
-            return WhoisRu(domain, text)
-        elif '.name' in domain:
+        elif domain.endswith('.name'):
         	return WhoisName(domain, text)
-        elif '.us' in domain:
+        elif domain.endswith('.me'):
+        	return WhoisMe(domain, text)
+        elif domain.endswith('.ru'):
+            return WhoisRu(domain, text)
+        elif domain.endswith('.us'):
         	return WhoisUs(domain, text)
-        elif '.me' in domain:
-        	return WhoisMe(domain, text)
-        elif '.uk' in domain:
+        elif domain.endswith('.uk'):
         	return WhoisUk(domain, text)
-        elif '.fr' in domain:
+        elif domain.endswith('.fr'):
             return WhoisFr(domain, text)
-        elif '.fi' in domain:
+        elif domain.endswith('.fi'):
         	return WhoisFi(domain, text)
-        elif '.jp' in domain:
+        elif domain.endswith('.jp'):
             return WhoisJp(domain, text)
         else:
             return WhoisEntry(domain, text)