Skip to content

Commit

Permalink
Add additional properties to Domain
Browse files Browse the repository at this point in the history
  • Loading branch information
mrinehart-r7 committed Oct 12, 2017
1 parent 2885db4 commit aee6cc6
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 27 deletions.
1 change: 1 addition & 0 deletions whois/_1_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import sys
import os


PYTHON_VERSION = sys.version_info[0]
CACHE = {}
CACHE_MAX_AGE = 60 * 60 * 48 # 48h
Expand Down
64 changes: 37 additions & 27 deletions whois/_3_adjust.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,43 @@

class Domain:
def __init__(self, data):
self.name = data['domain_name'][0].strip().lower()
self.registrar = data['registrar'][0].strip()
self.registrant_cc = data['registrant_cc'][0].strip().lower()
self.creation_date = str_to_date(data['creation_date'][0])
self.expiration_date = str_to_date(data['expiration_date'][0])
self.last_updated = str_to_date(data['updated_date'][0])

# ----------------------------------
# name_servers
tmp = []
for x in data['name_servers']:
if isinstance(x, str):
tmp.append(x)
else:
for y in x: tmp.append(y)

self.name_servers = set()
for x in tmp:
x = x.strip(' .')
if x:
if ' ' in x:
x, _ = x.split(' ', 1)
x = x.strip(' .')

self.name_servers.add(x.lower())

#----------------------------------
try:
self.name = data['domain_name'][0].strip().lower()
self.registrar = data['registrar'][0].strip()
self.registrant_cc = data['registrant_cc'][0].strip().lower()
self.creation_date = str_to_date(data['creation_date'][0])
self.expiration_date = str_to_date(data['expiration_date'][0])
self.last_updated = str_to_date(data['updated_date'][0])

tmp = []
for x in data['name_servers']:
if isinstance(x, str):
tmp.append(x)
else:
for y in x: tmp.append(y)

self.name_servers = set()
for x in tmp:
x = x.strip(' .')
if x:
if ' ' in x:
x, _ = x.split(' ', 1)
x = x.strip(' .')

self.name_servers.add(x.lower())

# Komand additions
self.registry_domain_id = data['registry_domain_id'][0].strip().lower()
self.registrar_whois_server = data['registrar_whois_server'][0].strip().lower()
self.registrar_url = data['registrar_url'][0].strip().lower()
self.registrar_iana_id = data['registrar_iana_id'][0].strip().lower()
self.registrar_abuse_contact_email = data['registrar_abuse_contact_email'][0].strip().lower()
self.registrar_abuse_contact_phone = data['registrar_abuse_contact_phone'][0].strip().lower()
self.domain_status = list(map(lambda ds: ds.strip().lower(),data['domain_status']))
self.dnssec = data['dnssec'][0].strip().lower()

except KeyError:
pass


# http://docs.python.org/library/datetime.html#strftime-strptime-behavior
Expand Down
10 changes: 10 additions & 0 deletions whois/tld_regexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@
'name_servers': r'Name Server:\s*(.+)\s*',
'status': r'Status:\s?(.+)',
'emails': r'[\w.-]+@[\w.-]+\.[\w]{2,4}',

# Komand additions
'registry_domain_id': r'Registry Domain ID:\s?(.+)',
'registrar_whois_server': r'Registrar WHOIS Server:\s?(.+)',
'registrar_url': r'Registrar URL:\s?(.+)',
'registrar_iana_id': r'Registrar IANA ID:\s(.+)',
'registrar_abuse_contact_email': r'Registrar Abuse Contact Email:\s(.+)',
'registrar_abuse_contact_phone': r'Registrar Abuse Contact Phone:\s(.+)',
'domain_status': r'Domain Status:\s(.+)',
'dnssec': r'DNSSEC:\s(.+)'
}

net = {
Expand Down

0 comments on commit aee6cc6

Please sign in to comment.