Skip to content
This repository has been archived by the owner on Feb 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #27 from thomas-tz/master
Browse files Browse the repository at this point in the history
Add support for .io and fixed some bug in date parsing
  • Loading branch information
DannyCork authored Apr 25, 2019
2 parents 93d3e62 + bb0fbbb commit 1605119
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
google.jp
www.google.co.jp
google.io
google.co
google.de
yandex.ru
Expand Down
14 changes: 9 additions & 5 deletions whois/_3_adjust.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ def __init__(self, data):
'%a %b %d %H:%M:%S %Z %Y', # Tue Jun 21 23:59:59 GMT 2011
'%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:%S.%fz', # 2007-01-26t19:10:31.00z
'%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
'%Y%m%d', # 20110908
Expand All @@ -81,12 +81,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))

13 changes: 9 additions & 4 deletions whois/tld_regexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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?(.+)',
Expand All @@ -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*',
Expand Down Expand Up @@ -143,8 +144,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?(.+)',
}
Expand Down Expand Up @@ -247,6 +248,11 @@
'status': r'status:\s?(.+)',
}

io = {
'extend': 'com',
'expiration_date': r'\nRegistry Expiry Date:\s?(.+)',
}

ca = {
'extend': 'com',

Expand Down Expand Up @@ -292,4 +298,3 @@
'registrant': r'\nRegistrant Organization:\s?(.+)',
'status': r'\nDomain Status:\s?(.+)',
}

0 comments on commit 1605119

Please sign in to comment.