Merged in hex2a/pywhois (pull request #8)
authorRichard Penman <richardbp@gmail.com>
Thu, 02 Jun 2016 13:57:58 -0700
changeset 89 0b2e70f3f537
parent 86 d6fcfa5acc7b (diff)
parent 88 124331d7ca1e (current diff)
child 91 4382433c1fe0
Merged in hex2a/pywhois (pull request #8) add .at tld
whois/parser.py
--- a/whois/__init__.py	Fri May 06 13:52:16 2016 +0000
+++ b/whois/__init__.py	Thu Jun 02 13:57:58 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:
--- a/whois/parser.py	Fri May 06 13:52:16 2016 +0000
+++ b/whois/parser.py	Thu Jun 02 13:57:58 2016 -0700
@@ -135,6 +135,8 @@
                     if value and value not in values:
                         # avoid duplicates
                         values.append(value)
+                if values and attr in ('registrar', 'whois_server', 'referral_url'):
+                    values = values[-1] # ignore junk
                 if len(values) == 1:
                     values = values[0]
                 elif not values:
@@ -563,7 +565,7 @@
         'domain_name': 'domain: *(.+)',
         'registrar': 'registrar: *(.+)',
         'creation_date': 'created: *(.+)',
-        'expiration_date': 'anniversary: *(.+)',
+        'expiration_date': 'Expir\w+ Date:\s?(.+)',
         'name_servers': 'nserver: *(.+)',  # list of name servers
         'status': 'status: *(.+)',  # list of statuses
         'emails': EMAIL_REGEX,  # list of email addresses
@@ -590,7 +592,7 @@
         'updated_date':                   'modified: *([\S]+)',
         'expiration_date':                'expires: *([\S]+)',
         'name_servers':                   'nserver: *([\S]+) \[\S+\]',  # list of name servers
-        'name_server_statuses':           'nserver: *([\S]+) \[(\S+)\]',  # list of name servers and statuses
+        'name_server_statuses':           'nserver: *([\S]+) \[\S+\]',  # list of name servers and statuses
         'dnssec':                         'dnssec: *([\S]+)',
     }