diff --git a/pythonwhois/parse.py b/pythonwhois/parse.py index 66217d6..edb8144 100644 --- a/pythonwhois/parse.py +++ b/pythonwhois/parse.py @@ -513,7 +513,10 @@ def parse_raw_whois(raw_data, normalized=None, never_query_handles=True, handle_ # SIDN isn't very standard either. And EURid uses a similar format. match = re.search("Registrar:\n\s+(?:Name:\s*)?(\S.*)", segment) if match is not None: - data["registrar"].insert(0, match.group(1).strip()) + try: + data["registrar"].insert(0, match.group(1).strip()) + except KeyError: + data["registrar"] = [match.group(1).strip()] match = re.search("(?:Domain nameservers|Name servers):([\s\S]*?\n)\n", segment) if match is not None: chunk = match.group(1) diff --git a/test/data/google.ca b/test/data/google.ca new file mode 100644 index 0000000..9821781 --- /dev/null +++ b/test/data/google.ca @@ -0,0 +1,44 @@ +[Querying whois.cira.ca] +[whois.cira.ca] +Domain name: google.ca +Domain status: registered +Creation date: 2000/10/03 +Expiry date: 2016/04/28 +Updated date: 2015/03/27 +DNSSEC: Unsigned + +Registrar: + Name: MarkMonitor International Canada Ltd. + Number: 5000040 + +Registrant: + Name: Google Inc. + +Administrative contact: + Name: Christina Chiou + Postal address: 130 King St. W., Suite 1800, + Toronto ON M5X1E3 Canada + Phone: +1.4168653361x + Fax: +1.4169456616 + Email: dns-admin@google.com + +Technical contact: + Name: Matt Serlin + Postal address: Domain Provisioning,10400 Overland Rd. PMB 155 + Boise ID 83709 United States + Phone: +1.2083895740x + Fax: +1.2083895771 + Email: ccops@markmonitor.com + +Name servers: + ns1.google.com + ns2.google.com + ns3.google.com + ns4.google.com + +% WHOIS look-up made at 2015-12-09 17:11:53 (GMT) +% +% Use of CIRA's WHOIS service is governed by the Terms of Use in its Legal +% Notice, available at http://www.cira.ca/legal-notice/?lang=en +% +% (c) 2015 Canadian Internet Registration Authority, (http://www.cira.ca/) diff --git a/test/target_default/google.ca b/test/target_default/google.ca new file mode 100644 index 0000000..f588fe2 --- /dev/null +++ b/test/target_default/google.ca @@ -0,0 +1 @@ +{"status": ["registered"], "updated_date": ["2015-03-27T00:00:00"], "contacts": {"admin": null, "tech": null, "registrant": null, "billing": null}, "nameservers": ["ns1.google.com", "ns2.google.com", "ns3.google.com", "ns4.google.com"], "expiration_date": ["2016-04-28T00:00:00"], "creation_date": ["2000-10-03T00:00:00"], "raw": ["[Querying whois.cira.ca]\n[whois.cira.ca]\nDomain name: google.ca\nDomain status: registered\nCreation date: 2000/10/03\nExpiry date: 2016/04/28\nUpdated date: 2015/03/27\nDNSSEC: Unsigned\n\nRegistrar:\n Name: MarkMonitor International Canada Ltd.\n Number: 5000040\n\nRegistrant:\n Name: Google Inc.\n\nAdministrative contact:\n Name: Christina Chiou\n Postal address: 130 King St. W., Suite 1800,\n Toronto ON M5X1E3 Canada\n Phone: +1.4168653361x\n Fax: +1.4169456616\n Email: dns-admin@google.com\n\nTechnical contact:\n Name: Matt Serlin\n Postal address: Domain Provisioning,10400 Overland Rd. PMB 155\n Boise ID 83709 United States\n Phone: +1.2083895740x\n Fax: +1.2083895771\n Email: ccops@markmonitor.com\n\nName servers:\n ns1.google.com\n ns2.google.com\n ns3.google.com\n ns4.google.com\n\n% WHOIS look-up made at 2015-12-09 17:11:53 (GMT)\n%\n% Use of CIRA's WHOIS service is governed by the Terms of Use in its Legal\n% Notice, available at http://www.cira.ca/legal-notice/?lang=en \n%\n% (c) 2015 Canadian Internet Registration Authority, (http://www.cira.ca/) \n"], "registrar": ["MarkMonitor International Canada Ltd."], "emails": ["dns-admin@google.com", "ccops@markmonitor.com"]} \ No newline at end of file diff --git a/test/target_normalized/google.ca b/test/target_normalized/google.ca new file mode 100644 index 0000000..cd0dfe1 --- /dev/null +++ b/test/target_normalized/google.ca @@ -0,0 +1 @@ +{"status": ["Registered"], "updated_date": ["2015-03-27T00:00:00"], "contacts": {"admin": null, "tech": null, "registrant": null, "billing": null}, "nameservers": ["ns1.google.com", "ns2.google.com", "ns3.google.com", "ns4.google.com"], "expiration_date": ["2016-04-28T00:00:00"], "creation_date": ["2000-10-03T00:00:00"], "raw": ["[Querying whois.cira.ca]\n[whois.cira.ca]\nDomain name: google.ca\nDomain status: registered\nCreation date: 2000/10/03\nExpiry date: 2016/04/28\nUpdated date: 2015/03/27\nDNSSEC: Unsigned\n\nRegistrar:\n Name: MarkMonitor International Canada Ltd.\n Number: 5000040\n\nRegistrant:\n Name: Google Inc.\n\nAdministrative contact:\n Name: Christina Chiou\n Postal address: 130 King St. W., Suite 1800,\n Toronto ON M5X1E3 Canada\n Phone: +1.4168653361x\n Fax: +1.4169456616\n Email: dns-admin@google.com\n\nTechnical contact:\n Name: Matt Serlin\n Postal address: Domain Provisioning,10400 Overland Rd. PMB 155\n Boise ID 83709 United States\n Phone: +1.2083895740x\n Fax: +1.2083895771\n Email: ccops@markmonitor.com\n\nName servers:\n ns1.google.com\n ns2.google.com\n ns3.google.com\n ns4.google.com\n\n% WHOIS look-up made at 2015-12-09 17:11:53 (GMT)\n%\n% Use of CIRA's WHOIS service is governed by the Terms of Use in its Legal\n% Notice, available at http://www.cira.ca/legal-notice/?lang=en \n%\n% (c) 2015 Canadian Internet Registration Authority, (http://www.cira.ca/) \n"], "registrar": ["MarkMonitor International Canada Ltd."], "emails": ["dns-admin@google.com", "ccops@markmonitor.com"]} \ No newline at end of file