@@ -247,6 +247,7 @@ def preprocess_regex(regex):
247247 " Registrant:\n (?P<organization>.+)\n (?P<name>.+) (?P<email>.+)\n (?P<phone>.*)\n (?P<fax>.*)\n (?P<street>.*)\n (?P<city>.+), (?P<state>[^,\n ]*)\n (?P<country>.+)\n " , # .com.tw (Western registrars)
248248 "Registrant:\n (?P<organization1>.+)\n (?P<organization2>.+)\n (?P<street1>.+?)(?:,+(?P<street2>.+?)(?:,+(?P<street3>.+?)(?:,+(?P<street4>.+?)(?:,+(?P<street5>.+?)(?:,+(?P<street6>.+?)(?:,+(?P<street7>.+?))?)?)?)?)?)?,(?P<city>.+),(?P<country>.+)\n \n Contact:\n (?P<name>.+) (?P<email>.+)\n TEL: (?P<phone>.+?)(?:(?:#|ext.?)(?P<phone_ext>.+))?\n FAX: (?P<fax>.+)(?:(?:#|ext.?)(?P<fax_ext>.+))?\n " , # .com.tw (TWNIC/SEEDNET, Taiwanese companies only?)
249249 "Registrant Contact Information:\n \n Company English Name \(It should be the same as the registered/corporation name on your Business Register Certificate or relevant documents\):(?P<organization1>.+)\n Company Chinese name:(?P<organization2>.+)\n Address: (?P<street>.+)\n Country: (?P<country>.+)\n Email: (?P<email>.+)\n " , # HKDNR (.hk)
250+ "Registrant ID:(?P<handle>.+)\n Registrant Name:(?P<name>.*)\n (?:Registrant Organization:(?P<organization>.*)\n )?Registrant Street1:(?P<street1>.+?)\n (?:Registrant Street2:(?P<street2>.+?)\n (?:Registrant Street2:(?P<street3>.+?)\n )?)?Registrant City:(?P<city>.+)\n Registrant State:(?P<state>.*)\n Registrant Postal Code:(?P<postalcode>.+)\n Registrant Country:(?P<country>[A-Z]+)\n Registrant Phone:(?P<phone>.*?)\n Registrant Fax:(?P<fax>.*)\n Registrant Email:(?P<email>.+)\n " , # Realtime Register
250251 "owner:\s+(?P<name>.+)" , # .br
251252 "person:\s+(?P<name>.+)" , # nic.ru (person)
252253 "org:\s+(?P<organization>.+)" , # nic.ru (organization)
@@ -284,6 +285,7 @@ def preprocess_regex(regex):
284285 "Tech Contact: (?P<handle>.+)\n (?P<organization>.+)\n (?P<street1>.+)\n (?P<street2>.+)\n (?:(?P<street3>.+)\n )?(?P<city>.+)\n (?P<postalcode>.+)\n (?P<country>[A-Z]+)\n " , # .co.th, format 6
285286 " Technical Contact:\n (?P<name>.+) (?P<email>.+)\n (?P<phone>.*)\n (?P<fax>.*)\n " , # .com.tw (Western registrars)
286287 "Technical Contact Information:\n \n (?:Given name: (?P<firstname>.+)\n )?(?:Family name: (?P<lastname>.+)\n )?(?:Company name: (?P<organization>.+)\n )?Address: (?P<street>.+)\n Country: (?P<country>.+)\n Phone: (?P<phone>.*)\n Fax: (?P<fax>.*)\n Email: (?P<email>.+)\n (?:Account Name: (?P<handle>.+)\n )?" , # HKDNR (.hk)
288+ "TECH ID:(?P<handle>.+)\n TECH Name:(?P<name>.*)\n (?:TECH Organization:(?P<organization>.*)\n )?TECH Street1:(?P<street1>.+?)\n (?:TECH Street2:(?P<street2>.+?)\n (?:TECH Street2:(?P<street3>.+?)\n )?)?TECH City:(?P<city>.+)\n TECH State:(?P<state>.*)\n TECH Postal Code:(?P<postalcode>.+)\n TECH Country:(?P<country>[A-Z]+)\n TECH Phone:(?P<phone>.*?)\n TECH Fax:(?P<fax>.*)\n TECH Email:(?P<email>.+)\n " , # Realtime Register
287289]
288290
289291admin_contact_regexes = [
@@ -309,6 +311,7 @@ def preprocess_regex(regex):
309311 "\[Tech-C\]\n Type: (?P<type>.+)\n Name: (?P<name>.+)\n (Organisation: (?P<organization>.+)\n ){0,1}(Address: (?P<street1>.+)\n ){1}(Address: (?P<street2>.+)\n ){0,1}(Address: (?P<street3>.+)\n ){0,1}(Address: (?P<street4>.+)\n ){0,1}PostalCode: (?P<postalcode>.+)\n City: (?P<city>.+)\n CountryCode: (?P<country>[A-Za-z]{2})\n Phone: (?P<phone>.+)\n Fax: (?P<fax>.+)\n Email: (?P<email>.+)\n (Remarks: (?P<remark>.+)\n ){0,1}Changed: (?P<changed>.+)" , # DeNIC
310312 " Administrative Contact:\n (?P<name>.+) (?P<email>.+)\n (?P<phone>.*)\n (?P<fax>.*)\n " , # .com.tw (Western registrars)
311313 "Administrative Contact Information:\n \n (?:Given name: (?P<firstname>.+)\n )?(?:Family name: (?P<lastname>.+)\n )?(?:Company name: (?P<organization>.+)\n )?Address: (?P<street>.+)\n Country: (?P<country>.+)\n Phone: (?P<phone>.*)\n Fax: (?P<fax>.*)\n Email: (?P<email>.+)\n (?:Account Name: (?P<handle>.+)\n )?" , # HKDNR (.hk)
314+ "ADMIN ID:(?P<handle>.+)\n ADMIN Name:(?P<name>.*)\n (?:ADMIN Organization:(?P<organization>.*)\n )?ADMIN Street1:(?P<street1>.+?)\n (?:ADMIN Street2:(?P<street2>.+?)\n (?:ADMIN Street2:(?P<street3>.+?)\n )?)?ADMIN City:(?P<city>.+)\n ADMIN State:(?P<state>.*)\n ADMIN Postal Code:(?P<postalcode>.+)\n ADMIN Country:(?P<country>[A-Z]+)\n ADMIN Phone:(?P<phone>.*?)\n ADMIN Fax:(?P<fax>.*)\n ADMIN Email:(?P<email>.+)\n " , # Realtime Register
312315]
313316
314317billing_contact_regexes = [
@@ -325,6 +328,7 @@ def preprocess_regex(regex):
325328 "Billing contact:\n (?: (?P<organization>.+)\n )? (?P<name>.+)\n (?P<email>.+)\n (?P<street>.+)\n (?P<city>.+), (?P<state>.+) (?P<postalcode>.+) (?P<country>.+)\n Phone: (?P<phone>.*)\n Fax: (?P<fax>.*)\n " , # Fabulous.com
326329 "Billing Contact Information :[ ]*\n [ ]+(?P<firstname>.*)\n [ ]+(?P<lastname>.*)\n [ ]+(?P<organization>.*)\n [ ]+(?P<email>.*)\n [ ]+(?P<street>.*)\n [ ]+(?P<city>.*)\n [ ]+(?P<postalcode>.*)\n [ ]+(?P<phone>.*)\n [ ]+(?P<fax>.*)\n \n " , # GAL Communication
327330 "Billing Contact:\n Name: (?P<name>.+)\n City: (?P<city>.+)\n State: (?P<state>.+)\n Country: (?P<country>.+)\n " , # Akky (.com.mx)
331+ "BILLING ID:(?P<handle>.+)\n BILLING Name:(?P<name>.*)\n (?:BILLING Organization:(?P<organization>.*)\n )?BILLING Street1:(?P<street1>.+?)\n (?:BILLING Street2:(?P<street2>.+?)\n (?:BILLING Street2:(?P<street3>.+?)\n )?)?BILLING City:(?P<city>.+)\n BILLING State:(?P<state>.*)\n BILLING Postal Code:(?P<postalcode>.+)\n BILLING Country:(?P<country>[A-Z]+)\n BILLING Phone:(?P<phone>.*?)\n BILLING Fax:(?P<fax>.*)\n BILLING Email:(?P<email>.+)\n " , # Realtime Register
328332]
329333
330334# Some registries use NIC handle references instead of directly listing contacts...
@@ -426,7 +430,8 @@ def is_string(data):
426430 return isinstance (data , str )
427431
428432
429- def parse_raw_whois (raw_data , normalized = [], never_query_handles = True , handle_server = "" ):
433+ def parse_raw_whois (raw_data , normalized = None , never_query_handles = True , handle_server = "" ):
434+ normalized = normalized or []
430435 data = {}
431436
432437 raw_data = [segment .replace ("\r " , "" ) for segment in raw_data ] # Carriage returns are the devil
@@ -995,4 +1000,4 @@ def parse_nic_contact(data):
9951000 for match in matches :
9961001 handle_contacts .append (match .groupdict ())
9971002
998- return handle_contacts
1003+ return handle_contacts
0 commit comments