Skip to content

Commit baee878

Browse files
committed
Fix post-processing of empty but existent registrant entries, like for the.ai
1 parent b09b3ad commit baee878

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed

pythonwhois/parse.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,10 @@ def normalize_data(data, normalized):
856856

857857
if contact[key] == "-" or contact[key].lower() == "n/a" or contact[key].lower() == "null":
858858
del contact[key]
859+
860+
if contact is not None and len(contact) == 0:
861+
# We don't have any actual data.
862+
data['contacts'][contact_type] = None
859863
return data
860864

861865
def deduplicate(value, fuzzy=False):

test/data/the.ai

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
DOMAIN INFORMATION
2+
3+
Complete Domain Name........: the.ai
4+
Organization Using Domain Name
5+
Organization Name..........:
6+
Street Address.............:
7+
City.......................:
8+
State......................:
9+
Postal Code................:
10+
Country....................:
11+
Administrative Contact
12+
NIC Handle (if known)......:
13+
(I)ndividual (R)ole........:
14+
Name (Last, First).........:
15+
Organization Name..........:
16+
Street Address.............:
17+
City.......................:
18+
State......................:
19+
Postal Code................:
20+
Country....................:
21+
Phone Number...............:
22+
Fax Number.................:
23+
E-Mailbox..................: [email protected]
24+
Technical Contact
25+
NIC Handle (if known)......:
26+
(I)ndividual (R)ole........:
27+
Name (Last, First).........:
28+
Organization Name..........:
29+
Street Address.............:
30+
City.......................:
31+
State......................:
32+
Postal Code................:
33+
Country....................:
34+
Phone Number...............:
35+
Fax Number.................:
36+
E-Mailbox..................:
37+
Billing Contact
38+
NIC Handle (if known)......:
39+
(I)ndividual (R)ole........:
40+
Name (Last, First).........:
41+
Organization Name..........:
42+
Street Address.............:
43+
City.......................:
44+
State......................:
45+
Postal Code................:
46+
Country....................:
47+
Phone Number...............:
48+
Fax Number.................:
49+
E-Mailbox..................:
50+
Nameservers
51+
Primary Server Hostname....: ns51.1and1.com
52+
Primary Server Netaddress..:
53+
Secondary Server Hostname..: ns52.1and1.com
54+
Secondary Server Netaddress:
55+
Third Server Hostname......:
56+
Fourth Server Hostname.....:
57+
58+
59+
Last paid by: [email protected]
60+

test/target_default/the.ai

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"nameservers": ["ns51.1and1.com", "ns52.1and1.com"], "raw": ["DOMAIN INFORMATION\n\n Complete Domain Name........: the.ai\nOrganization Using Domain Name\n Organization Name..........: \n Street Address.............: \n City.......................: \n State......................: \n Postal Code................: \n Country....................: \nAdministrative Contact\n NIC Handle (if known)......: \n (I)ndividual (R)ole........: \n Name (Last, First).........: \n Organization Name..........: \n Street Address.............: \n City.......................: \n State......................: \n Postal Code................: \n Country....................: \n Phone Number...............: \n Fax Number.................: \n E-Mailbox..................: [email protected]\nTechnical Contact\n NIC Handle (if known)......: \n (I)ndividual (R)ole........: \n Name (Last, First).........: \n Organization Name..........: \n Street Address.............: \n City.......................: \n State......................: \n Postal Code................: \n Country....................: \n Phone Number...............: \n Fax Number.................: \n E-Mailbox..................: \nBilling Contact\n NIC Handle (if known)......: \n (I)ndividual (R)ole........: \n Name (Last, First).........: \n Organization Name..........: \n Street Address.............: \n City.......................: \n State......................: \n Postal Code................: \n Country....................: \n Phone Number...............: \n Fax Number.................: \n E-Mailbox..................: \nNameservers\n Primary Server Hostname....: ns51.1and1.com\n Primary Server Netaddress..: \n Secondary Server Hostname..: ns52.1and1.com\n Secondary Server Netaddress: \n Third Server Hostname......: \n Fourth Server Hostname.....: \n\n\nLast paid by: [email protected]\n\n"], "contacts": {"admin": {"email": "[email protected]"}, "tech": {}, "registrant": {}, "billing": {}}}

test/target_normalized/the.ai

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"nameservers": ["ns51.1and1.com", "ns52.1and1.com"], "raw": ["DOMAIN INFORMATION\n\n Complete Domain Name........: the.ai\nOrganization Using Domain Name\n Organization Name..........: \n Street Address.............: \n City.......................: \n State......................: \n Postal Code................: \n Country....................: \nAdministrative Contact\n NIC Handle (if known)......: \n (I)ndividual (R)ole........: \n Name (Last, First).........: \n Organization Name..........: \n Street Address.............: \n City.......................: \n State......................: \n Postal Code................: \n Country....................: \n Phone Number...............: \n Fax Number.................: \n E-Mailbox..................: [email protected]\nTechnical Contact\n NIC Handle (if known)......: \n (I)ndividual (R)ole........: \n Name (Last, First).........: \n Organization Name..........: \n Street Address.............: \n City.......................: \n State......................: \n Postal Code................: \n Country....................: \n Phone Number...............: \n Fax Number.................: \n E-Mailbox..................: \nBilling Contact\n NIC Handle (if known)......: \n (I)ndividual (R)ole........: \n Name (Last, First).........: \n Organization Name..........: \n Street Address.............: \n City.......................: \n State......................: \n Postal Code................: \n Country....................: \n Phone Number...............: \n Fax Number.................: \n E-Mailbox..................: \nNameservers\n Primary Server Hostname....: ns51.1and1.com\n Primary Server Netaddress..: \n Secondary Server Hostname..: ns52.1and1.com\n Secondary Server Netaddress: \n Third Server Hostname......: \n Fourth Server Hostname.....: \n\n\nLast paid by: [email protected]\n\n"], "contacts": {"admin": {"email": "[email protected]"}, "tech": null, "registrant": null, "billing": null}}

0 commit comments

Comments
 (0)