Merged in aseques/pywhois (pull request #26)
authorRichard <richardbp@gmail.com>
Fri, 01 Dec 2017 21:36:56 +0000
changeset 141 ec0994c0a2a0
parent 139 369f758afd9b (current diff)
parent 140 196df98347d8 (diff)
child 142 b05fc644a1b2
Merged in aseques/pywhois (pull request #26) All the failing tests fixed
whois/parser.py
--- a/test/test_main.py	Fri Dec 01 21:21:05 2017 +0000
+++ b/test/test_main.py	Fri Dec 01 21:36:56 2017 +0000
@@ -19,7 +19,7 @@
 
     def test_ascii_with_schema_path_and_query(self):
         url = 'https://www.google.com/search?q=why+is+domain+whois+such+a+mess'
-        domain = 'www.google.com'
+        domain = 'google.com'
         self.assertEqual(domain, extract_domain(url))
 
     def test_simple_unicode_domain(self):
--- a/whois/__init__.py	Fri Dec 01 21:21:05 2017 +0000
+++ b/whois/__init__.py	Fri Dec 01 21:36:56 2017 +0000
@@ -79,17 +79,17 @@
     if not isinstance(url, str):
         url = url.decode('utf-8')
     url = re.sub('^.*://', '', url)
-    url = url.split('/')[0].lower().encode('idna')
+    url = url.split('/')[0].lower()
 
     # find the longest suffix match
     domain = b''
-    for section in reversed(url.split(b'.')):
+    for section in reversed(url.split('.')):
         if domain:
             domain = b'.' + domain
-        domain = section + domain
+        domain = section.encode('utf-8') + domain
         if domain not in suffixes:
             break
-    return domain.decode('idna')
+    return domain.decode('utf-8')
 
 
 if __name__ == '__main__':
--- a/whois/parser.py	Fri Dec 01 21:21:05 2017 +0000
+++ b/whois/parser.py	Fri Dec 01 21:36:56 2017 +0000
@@ -30,6 +30,7 @@
 
 KNOWN_FORMATS = [
     '%d-%b-%Y', 				# 02-jan-2000
+    '%d-%m-%Y', 				# 20-10-2000
     '%Y-%m-%d', 				# 2000-01-02
     '%d.%m.%Y', 				# 2.1.2000
     '%Y.%m.%d',                 # 2000.01.02