Skip to content

Commit

Permalink
Support the "Registrar WHOIS Server" key name for the referral
Browse files Browse the repository at this point in the history
The ICANN “Registry Registration Data Directory Services
Consistent Labeling and Display Policy” [1] renames the key
from "WHOIS Server" to this.

Remove duplicate "whois server" entry, as noticed by @devl00p

Fixes joepie91#131

[1] https://www.icann.org/resources/pages/rdds-labeling-policy-2017-02-01-en
  • Loading branch information
Ángel González committed Dec 8, 2017
1 parent 7b0ddf7 commit bc8c032
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pythonwhois/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def get_whois_raw(domain, server="", previous=None, rfc3490=True, never_cut=Fals
new_list = [response] + previous
server_list.append(target_server)
for line in [x.strip() for x in response.splitlines()]:
match = re.match("(refer|whois server|referral url|whois server|registrar whois):\s*([^\s]+\.[^\s]+)", line, re.IGNORECASE)
match = re.match("(refer|whois server|referral url|registrar whois(?: server)?):\s*([^\s]+\.[^\s]+)", line, re.IGNORECASE)
if match is not None:
referal_server = match.group(2)
if referal_server != server and "://" not in referal_server: # We want to ignore anything non-WHOIS (eg. HTTP) for now.
Expand Down
3 changes: 2 additions & 1 deletion pythonwhois/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ def precompile_regexes(source, flags=0):
'Domain Registrar :\s?(?P<val>.+)',
'Registration Service Provider: (?P<val>.+)',
'\tName:\t\s(?P<val>.+)'],
'whois_server': ['Whois Server:\s?(?P<val>.+)',
'whois_server': ['Registrar WHOIS Server:\s?(?P<val>.+)',
'Whois Server:\s?(?P<val>.+)',
'Registrar Whois:\s?(?P<val>.+)'],
'nameservers': ['Name Server:[ ]*(?P<val>[^ ]+)',
'Nameservers:[ ]*(?P<val>[^ ]+)',
Expand Down

0 comments on commit bc8c032

Please sign in to comment.