From b07db9a8d7eaa74d3df9bb970038350ef8594633 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 5 Sep 2017 09:10:20 +0100 Subject: [PATCH 1/6] Add git ignore file --- .gitignore | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e16f5db --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +__pycache__ +*.pyc +.pypirc + +upload.sh +build +dist + From ec56fb287a7647580f825d7a1b436d84007ff068 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 5 Sep 2017 09:11:14 +0100 Subject: [PATCH 2/6] Fix .org Expiration Date --- whois/tld_regexpr.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/whois/tld_regexpr.py b/whois/tld_regexpr.py index c97532e..509a716 100644 --- a/whois/tld_regexpr.py +++ b/whois/tld_regexpr.py @@ -22,6 +22,7 @@ 'extend': 'com', 'creation_date': r'\nCreated On:\s?(.+)', +'expiration_date': r'\nRegistry Expiry Date:\s?(.+)', 'updated_date': r'\nLast Updated On:\s?(.+)', 'name_servers': r'Name Server:\s?(.+)\s*', @@ -233,4 +234,4 @@ 'name_servers': r'nserver:\s*(.+)', 'status': r'status:\s?(.+)', -} \ No newline at end of file +} From 65a383146f4c57f4de0fd863afd118b7f9261ebd Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 5 Sep 2017 10:33:03 +0100 Subject: [PATCH 3/6] Add support for .io --- test.py | 1 + whois/tld_regexpr.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/test.py b/test.py index 2314d4c..c0d0cc2 100644 --- a/test.py +++ b/test.py @@ -23,6 +23,7 @@ google.jp www.google.co.jp +google.io google.co google.de yandex.ru diff --git a/whois/tld_regexpr.py b/whois/tld_regexpr.py index 509a716..60d2014 100644 --- a/whois/tld_regexpr.py +++ b/whois/tld_regexpr.py @@ -235,3 +235,8 @@ 'name_servers': r'nserver:\s*(.+)', 'status': r'status:\s?(.+)', } + +io = { +'extend': 'com', +'expiration_date': r'\nRegistry Expiry Date:\s?(.+)', +} \ No newline at end of file From 49e01ba291de1e6cce916e7414e031158ed1608e Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 8 Sep 2017 08:36:24 +0100 Subject: [PATCH 4/6] Fix date parsing if date finish with timezone in hours format (ie: +0200) --- whois/_3_adjust.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/whois/_3_adjust.py b/whois/_3_adjust.py index f38f785..367fafe 100644 --- a/whois/_3_adjust.py +++ b/whois/_3_adjust.py @@ -9,6 +9,7 @@ class Domain: def __init__(self, data): + self.name = data['domain_name'][0].strip().lower() self.registrar = data['registrar'][0].strip() self.creation_date = str_to_date(data['creation_date'][0]) @@ -66,7 +67,9 @@ def __init__(self, data): '%a %b %d %Y', # Tue Dec 12 2000 '%Y-%m-%dT%H:%M:%S', # 2007-01-26T19:10:31 '%Y-%m-%dT%H:%M:%SZ', # 2007-01-26T19:10:31Z + '%Y-%m-%dt%H:%M:%Sz', # 2007-01-26T19:10:31Z '%Y-%m-%dT%H:%M:%S%z', # 2011-03-30T19:36:27+0200 + '%Y-%m-%dt%H:%M:%S%z', # 2011-03-30t19:36:27+0200 '%Y-%m-%dT%H:%M:%S.%f%z', # 2011-09-08T14:44:51.622265+03:00 '%Y-%m-%dt%H:%M:%S.%f', # 2011-09-08t14:44:51.622265 ] @@ -90,12 +93,16 @@ def str_to_date(s): def str_to_date_py2(s): tmp = re.findall('\+([0-9]{2})00', s) - if tmp: tz = int(tmp[0]) - else: tz = 0 + if tmp: + dstr=s[:-5] + tz = int(tmp[0]) + else: + dstr=s + tz = 0 for format in DATE_FORMATS: - try: return datetime.datetime.strptime(s, format) + datetime.timedelta(hours=tz) + try: return datetime.datetime.strptime(dstr, format) + datetime.timedelta(hours=tz) except ValueError as e: pass - raise ValueError("Unknown date format: '%s'" % s) + raise ValueError("Unknown date format: '%s' (Origin %s)" % (dstr,s)) From b8fb2fb76512269271029baa5e20e7a340b589eb Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 8 Sep 2017 08:36:56 +0100 Subject: [PATCH 5/6] Fix .com if not updated date --- whois/tld_regexpr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/whois/tld_regexpr.py b/whois/tld_regexpr.py index 60d2014..78a4a5e 100644 --- a/whois/tld_regexpr.py +++ b/whois/tld_regexpr.py @@ -7,7 +7,7 @@ 'creation_date': r'Creation Date:\s?(.+)', 'expiration_date': r'Expiration Date:\s?(.+)', -'updated_date': r'Updated Date:\s?(.+)', +'updated_date': r'Updated Date:\s?(.+)$', 'name_servers': r'Name Server:\s*(.+)\s*', 'status': r'Status:\s?(.+)', From 9254863e3bf1cea5cd5f6b6c990ad38b327c300f Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 8 Sep 2017 08:38:33 +0100 Subject: [PATCH 6/6] Fix .infor if empty dates --- whois/tld_regexpr.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/whois/tld_regexpr.py b/whois/tld_regexpr.py index 78a4a5e..b0784e3 100644 --- a/whois/tld_regexpr.py +++ b/whois/tld_regexpr.py @@ -132,8 +132,8 @@ 'extend': 'biz', 'creation_date': r'Created On:\s?(.+)', -'expiration_date': r'Expiration Date:\s?(.+)', -'updated_date': r'Last Updated On:\s?(.+)', +'expiration_date': r'Expiration Date:\s?(.+)$', +'updated_date': r'Last Updated On:\s?(.+)$', 'status': r'Status:\s?(.+)', }