From cf9564673bc931aed2d3de5de1883315aa7a312e Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Thu, 21 Nov 2013 08:22:49 +0100 Subject: [PATCH] Support for .au domains --- pythonwhois/parse.py | 12 +++++++----- test/data/actu.org.au | 25 +++++++++++++++++++++++++ test/data/australia.gov.au | 22 ++++++++++++++++++++++ test/data/linux.conf.au | 25 +++++++++++++++++++++++++ test/data/mu.oz.au | 2 ++ test/data/oli.id.au | 20 ++++++++++++++++++++ test/data/sydney.edu.au | 23 +++++++++++++++++++++++ test/data/whirlpool.net.au | 26 ++++++++++++++++++++++++++ 8 files changed, 150 insertions(+), 5 deletions(-) create mode 100644 test/data/actu.org.au create mode 100644 test/data/australia.gov.au create mode 100644 test/data/linux.conf.au create mode 100644 test/data/mu.oz.au create mode 100644 test/data/oli.id.au create mode 100644 test/data/sydney.edu.au create mode 100644 test/data/whirlpool.net.au diff --git a/pythonwhois/parse.py b/pythonwhois/parse.py index 02dccc2..b09bed6 100644 --- a/pythonwhois/parse.py +++ b/pythonwhois/parse.py @@ -196,6 +196,7 @@ def normalize_data(data, normalized): if isinstance(data[key], basestring) and data[key].isupper(): data[key] = " ".join(word.capitalize() for word in data[key].split(" ")) else: + # This might mess up the order? Also seems like there may be another bug here... data[key] = [" ".join(word.capitalize() for word in item.split(" ")) for item in data[key] if item.isupper()] + [item for item in data[key] if not item.isupper()] for contact_type, contact in data['contacts'].iteritems(): @@ -209,10 +210,7 @@ def normalize_data(data, normalized): for key in ("name", "street", "city", "state"): if key in contact and contact[key] is not None and (normalized == True or key in normalized): - if isinstance(contact[key], basestring) and contact[key].isupper(): - contact[key] = " ".join(word.capitalize() for word in contact[key].split(" ")) - else: - contact[key] = [" ".join(word.capitalize() for word in item.split(" ")) for item in contact[key] if item.isupper()] + [item for item in contact[key] if not item.isupper()] + contact[key] = " ".join(word.capitalize() for word in contact[key].split(" ")) return data @@ -319,6 +317,9 @@ def parse_registrants(data): "Holder of domain name:\n(?P[\S\s]+)\n(?P.+)\n(?P[A-Z0-9-]+)\s+(?P.+)\n(?P.+)\nContractual Language", # nic.ch "\n\n(?:Owner)?\s+: (?P.*)\n(?:\s+: (?P.*)\n)?\s+: (?P.*)\n\s+: (?P.*)\n\s+: (?P.*)\n\s+: (?P.*)\n", # nic.io "Contact Information:\n\[Name\]\s*(?P.*)\n\[Email\]\s*(?P.*)\n\[Web Page\]\s*(?P.*)\n\[Postal code\]\s*(?P.*)\n\[Postal Address\]\s*(?P.*)\n(?:\s+(?P.*)\n)?(?:\s+(?P.*)\n)?\[Phone\]\s*(?P.*)\n\[Fax\]\s*(?P.*)\n", # jprs.jp + "Registrant:[ ]*(?P.+)\n[\s\S]*Eligibility Name:[ ]*(?P.+)\n[\s\S]*Registrant Contact ID:[ ]*(?P.+)\n", # .au business + "Eligibility Type:[ ]*Citizen\/Resident\n[\s\S]*Registrant Contact ID:[ ]*(?P.+)\n[\s\S]*Registrant Contact Name:[ ]*(?P.+)\n", # .au individual + "Registrant:[ ]*(?P.+)\n[\s\S]*Eligibility Type:[ ]*(Higher Education Institution|Company|Incorporated Association|Other)\n[\s\S]*Registrant Contact ID:[ ]*(?P.+)\n[\s\S]*Registrant Contact Name:[ ]*(?P.+)\n", # .au educational, company, 'incorporated association' (non-profit?), other (spotted for linux.conf.au, unsure if also for others) "person:\s+(?P.+)", # nic.ru (person) "org:\s+(?P.+)", # nic.ru (organization) ] @@ -330,7 +331,8 @@ def parse_registrants(data): "Tech Contact: (?P.+)\nTech Organization: (?P.+)\nTech Name: (?P.+)\nTech Street: (?P.+)\nTech City: (?P.+)\nTech Postal Code: (?P.+)\nTech State: (?P.+)\nTech Country: (?P.+)\nTech Phone: (?P.*)\nTech Phone Ext: (?P.*)\nTech Fax: (?P.*)\nTech Fax Ext: (?P.*)\nTech Email: (?P.*)\n", # Key-Systems GmbH "(?:Tech ID:[ ]*(?P.*)\n)?Tech[ ]*Name:[ ]*(?P.*)\nTech[ ]*Organization:[ ]*(?P.*)\nTech[ ]*Street:[ ]*(?P.+)\n(?:Tech[ ]*Street:[ ]*(?P.+)\n)?Tech[ ]*City:[ ]*(?P.+)\nTech[ ]*State\/Province:[ ]*(?P.+)\nTech[ ]*Postal[ ]*Code:[ ]*(?P.+)\nTech[ ]*Country:[ ]*(?P.+)\n(?:Tech[ ]*Phone:[ ]*(?P.*)\n)?(?:Tech[ ]*Phone[ ]*Ext:[ ]*(?P.*)\n)?(?:Tech[ ]*Fax:[ ]*(?P.*)\n)?(?:Tech[ ]*Fax[ ]*Ext:\s*?(?P.*)\n)?(?:Tech[ ]*Email:[ ]*(?P.+)\n)?", # WildWestDomains, GoDaddy, Namecheap/eNom, Ascio, Musedoma (.museum) "Technical Contact\n (?P.+)\n Email:(?P.+)\n (?P.+)\n(?: (?P.+)\n)? (?P.+) (?P.+)\n (?P.+)\n Tel: (?P.+)\n\n", # internet.bs - "Technical contact:\n(?P[\S\s]+)\n(?P.+)\n(?P[A-Z0-9-]+)\s+(?P.+)\n(?P.+)\n\n" # nic.ch + "Technical contact:\n(?P[\S\s]+)\n(?P.+)\n(?P[A-Z0-9-]+)\s+(?P.+)\n(?P.+)\n\n", # nic.ch + "Tech Contact ID:[ ]*(?P.+)\nTech Contact Name:[ ]*(?P.+)" ] admin_contact_regexes = [ diff --git a/test/data/actu.org.au b/test/data/actu.org.au new file mode 100644 index 0000000..e5d2750 --- /dev/null +++ b/test/data/actu.org.au @@ -0,0 +1,25 @@ +Domain Name: actu.org.au +Last Modified: 09-Sep-2013 02:21:17 UTC +Registrar ID: NetRegistry +Registrar Name: NetRegistry +Status: ok + +Registrant: Australian Council of Trade Unions +Eligibility Type: Incorporated Association +Eligibility ID: ABN 67175982800 + +Registrant Contact ID: WORO1080 +Registrant Contact Name: Peter Watkins +Registrant Contact Email: Visit whois.ausregistry.com.au for Web based WhoIs + +Tech Contact ID: WAPE1350 +Tech Contact Name: Peter Watkins +Tech Contact Email: Visit whois.ausregistry.com.au for Web based WhoIs + +Name Server: ns15.dnsmadeeasy.com +Name Server: ns10.dnsmadeeasy.com +Name Server: ns11.dnsmadeeasy.com +Name Server: ns12.dnsmadeeasy.com +Name Server: ns13.dnsmadeeasy.com +Name Server: ns14.dnsmadeeasy.com + diff --git a/test/data/australia.gov.au b/test/data/australia.gov.au new file mode 100644 index 0000000..4b9f1e9 --- /dev/null +++ b/test/data/australia.gov.au @@ -0,0 +1,22 @@ +Domain Name: australia.gov.au +Last Modified: 04-Jun-2013 02:20:37 UTC +Registrar ID: Finance +Registrar Name: Department of Finance +Status: ok + +Registrant: Department of Finance and Deregulation +Eligibility Type: Other + +Registrant Contact ID: GOVAU-IVLY1033 +Registrant Contact Name: Web Manager +Registrant Contact Email: Visit whois.ausregistry.com.au for Web based WhoIs + +Tech Contact ID: GOVAU-SUTE1002 +Tech Contact Name: Technical Support +Tech Contact Email: Visit whois.ausregistry.com.au for Web based WhoIs + +Name Server: dns1.sge.net +Name Server: dns2.sge.net +Name Server: dns3.sge.net +Name Server: dns4.sge.net + diff --git a/test/data/linux.conf.au b/test/data/linux.conf.au new file mode 100644 index 0000000..b80f195 --- /dev/null +++ b/test/data/linux.conf.au @@ -0,0 +1,25 @@ +Domain Name: linux.conf.au +Last Modified: 29-Apr-2011 09:22:00 UTC +Registrar ID: auDA +Registrar Name: auDA +Status: serverUpdateProhibited (Regulator Domain) +Status: serverTransferProhibited (Regulator Domain) +Status: serverDeleteProhibited (Regulator Domain) +Status: serverRenewProhibited (Regulator Domain) + +Registrant: .au Domain Administration Ltd +Registrant ID: OTHER 079 009 340 +Eligibility Type: Other + +Registrant Contact ID: C28042011 +Registrant Contact Name: Stephen Walsh +Registrant Contact Email: Visit whois.ausregistry.com.au for Web based WhoIs + +Tech Contact ID: C28042011 +Tech Contact Name: Stephen Walsh +Tech Contact Email: Visit whois.ausregistry.com.au for Web based WhoIs + +Name Server: russell.linux.org.au +Name Server IP: 202.158.218.245 +Name Server: daedalus.andrew.net.au + diff --git a/test/data/mu.oz.au b/test/data/mu.oz.au new file mode 100644 index 0000000..f254976 --- /dev/null +++ b/test/data/mu.oz.au @@ -0,0 +1,2 @@ +No Data Found + diff --git a/test/data/oli.id.au b/test/data/oli.id.au new file mode 100644 index 0000000..c7378da --- /dev/null +++ b/test/data/oli.id.au @@ -0,0 +1,20 @@ +Domain Name: oli.id.au +Last Modified: 03-Nov-2013 02:04:00 UTC +Registrar ID: PlanetDomain +Registrar Name: PlanetDomain +Status: ok + +Registrant: Oliver Ransom +Eligibility Type: Citizen/Resident + +Registrant Contact ID: ID00182825-PR +Registrant Contact Name: Oliver Ransom +Registrant Contact Email: Visit whois.ausregistry.com.au for Web based WhoIs + +Tech Contact ID: ID00182825-PR +Tech Contact Name: Oliver Ransom +Tech Contact Email: Visit whois.ausregistry.com.au for Web based WhoIs + +Name Server: ns1.r4ns.com +Name Server: ns2.r4ns.com + diff --git a/test/data/sydney.edu.au b/test/data/sydney.edu.au new file mode 100644 index 0000000..f42944b --- /dev/null +++ b/test/data/sydney.edu.au @@ -0,0 +1,23 @@ +Domain Name: sydney.edu.au +Last Modified: 29-Aug-2012 01:33:23 UTC +Registrar ID: EducationAU +Registrar Name: Education Service Australia Ltd +Status: ok + +Registrant: The University of Sydney +Registrant ID: ABN 15211513464 +Eligibility Type: Higher Education Institution + +Registrant Contact ID: EDU2782-R +Registrant Contact Name: Network Services +Registrant Contact Email: Visit whois.ausregistry.com.au for Web based WhoIs + +Tech Contact ID: EDU46834-C +Tech Contact Name: Network Services +Tech Contact Email: Visit whois.ausregistry.com.au for Web based WhoIs + +Name Server: extro.ucc.usyd.edu.au +Name Server IP: 129.78.64.1 +Name Server: metro.ucc.usyd.edu.au +Name Server IP: 129.78.64.2 + diff --git a/test/data/whirlpool.net.au b/test/data/whirlpool.net.au new file mode 100644 index 0000000..675e3ad --- /dev/null +++ b/test/data/whirlpool.net.au @@ -0,0 +1,26 @@ +Domain Name: whirlpool.net.au +Last Modified: 06-Feb-2012 09:28:40 UTC +Registrar ID: NetRegistry +Registrar Name: NetRegistry +Status: ok + +Registrant: Simon Wright +Eligibility Type: Registered Business +Eligibility Name: Whirlpool Broadband Multimedia +Eligibility ID: NSW BN BN98319722 + +Registrant Contact ID: WRSI1010 +Registrant Contact Name: Simon Wright +Registrant Contact Email: Visit whois.ausregistry.com.au for Web based WhoIs + +Tech Contact ID: WRSI1010 +Tech Contact Name: Simon Wright +Tech Contact Email: Visit whois.ausregistry.com.au for Web based WhoIs + +Name Server: ns0.bulletproof.net.au +Name Server IP: 202.44.98.24 +Name Server: ns1.bulletproof.net.au +Name Server IP: 64.71.152.56 +Name Server: ns1.bulletproofnetworks.net +Name Server: ns0.bulletproofnetworks.net +