From e5cab1aeb385eb39c1084c38a416282a52e1c8ef Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Fri, 21 Sep 2012 07:30:55 +0200 Subject: [PATCH] Handle GoDaddy whois properly --- pythonwhois/__init__.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pythonwhois/__init__.py b/pythonwhois/__init__.py index ef5661d..838dddd 100644 --- a/pythonwhois/__init__.py +++ b/pythonwhois/__init__.py @@ -51,13 +51,14 @@ grammar = { 'registrar': ['Registered through:\s?(?P.+)', 'Registrar Name:\s?(?P.+)', 'Record maintained by:\s?(?P.+)', - 'Registration Service Provided By:\s?(?P.+)'], + 'Registration Service Provided By:\s?(?P.+)', + '\tName:\t\s(?P.+)'], 'whois_server': ['Registrar Whois:\s?(?P.+)'], 'name_servers': ['(?P[a-z]*d?ns[0-9]+([a-z]{3})?\.([a-z0-9-]+\.)+[a-z0-9]+)', '(?P[a-z0-9-]+\.d?ns[0-9]*\.([a-z0-9-]+\.)+[a-z0-9]+)', '(?P([a-z0-9-]+\.)+[a-z0-9]+)(\s+([0-9]{1,3}\.){3}[0-9]{1,3})', 'DNS[0-9]+:\s*(?P.+)', - '(?Pdns\.([a-z0-9-]+\.)+[a-z0-9]+)'], + '[^a-z0-9-](?Pdns\.([a-z0-9-]+\.)+[a-z0-9]+)'], 'emails': ['(?P[\w.-]+@[\w.-]+\.[\w]{2,4})'] }, "_dateformats": ( @@ -206,6 +207,12 @@ def parse_dates(dates): year = int(result.group("year")) day = int(result.group("day")) + # Detect and correct shorthand year notation + if year < 60: + year += 2000 + elif year < 100: + year += 1900 + # This will require some more guesswork - some WHOIS servers present the name of the month try: month = int(result.group("month"))