From 1c0540884752110458e981cde6d06fe97584a96e Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Thu, 5 Jun 2014 21:23:04 +0200 Subject: [PATCH] Implement CNNIC (.cn). Fixes #19. --- pythonwhois/parse.py | 2 ++ test/data/google.cn | 20 ++++++++++++++++++++ test/data/sina.com.cn | 20 ++++++++++++++++++++ test/target_default/google.cn | 1 + test/target_default/sina.com.cn | 1 + test/target_normalized/google.cn | 1 + test/target_normalized/sina.com.cn | 1 + 7 files changed, 46 insertions(+) create mode 100644 test/data/google.cn create mode 100644 test/data/sina.com.cn create mode 100644 test/target_default/google.cn create mode 100644 test/target_default/sina.com.cn create mode 100644 test/target_normalized/google.cn create mode 100644 test/target_normalized/sina.com.cn diff --git a/pythonwhois/parse.py b/pythonwhois/parse.py index e852865..040ddbc 100644 --- a/pythonwhois/parse.py +++ b/pythonwhois/parse.py @@ -11,6 +11,7 @@ grammar = { 'Created on[.]*: [a-zA-Z]+, (?P.+)', 'Creation Date:\s?(?P.+)', 'Creation date\s*:\s?(?P.+)', + 'Registration Date:\s?(?P.+)', 'Created Date:\s?(?P.+)', 'Created on:\s?(?P.+)', 'Created on\s?[.]*:\s?(?P.+)\.', @@ -526,6 +527,7 @@ def parse_registrants(data): " Registrant:\n (?P.+)\n\n Registrant type:\n .*\n\n Registrant's address:\n The registrant .* opted to have", # Nominet (.uk) with hidden address " Registrant:\n (?P.+)\n\n[\s\S]* Registrant type:\n .*\n\n Registrant's address:\n (?P.+)\n(?: (?P.+)\n(?: (?P.+)\n)??)?? (?P[^0-9\n]+)\n(?: (?P.+)\n)? (?P.+)\n (?P.+)\n\n", # Nominet (.uk) with visible address "Domain Owner:\n\t(?P.+)\n\n[\s\S]*?(?:Registrant Contact:\n\t(?P.+))?\n\nRegistrant(?:'s)? (?:a|A)ddress:(?:\n\t(?P.+)\n(?:\t(?P.+)\n)?(?:\t(?P.+)\n)?\t(?P.+)\n\t(?P.+))?\n\t(?P.+)(?:\n\t(?P.+) \(Phone\)\n\t(?P.+) \(FAX\)\n\t(?P.+))?\n\n", # .ac.uk - what a mess... + "Registrant ID: (?P.+)\nRegistrant: (?P.+)\nRegistrant Contact Email: (?P.+)", # .cn (CNNIC) "Registrant contact:\n (?P.+)\n (?P.*)\n (?P.+), (?P.+) (?P.+) (?P.+)\n\n", # Fabulous.com "registrant-name:\s*(?P.+)\nregistrant-type:\s*(?P.+)\nregistrant-address:\s*(?P.+)\nregistrant-postcode:\s*(?P.+)\nregistrant-city:\s*(?P.+)\nregistrant-country:\s*(?P.+)\n(?:registrant-phone:\s*(?P.+)\n)?(?:registrant-email:\s*(?P.+)\n)?", # Hetzner "Registrant Contact Information :[ ]*\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n[ ]+(?P.*)\n\n", # GAL Communication diff --git a/test/data/google.cn b/test/data/google.cn new file mode 100644 index 0000000..065a895 --- /dev/null +++ b/test/data/google.cn @@ -0,0 +1,20 @@ +Domain Name: google.cn +ROID: 20030311s10001s00033735-cn +Domain Status: clientDeleteProhibited +Domain Status: serverDeleteProhibited +Domain Status: clientUpdateProhibited +Domain Status: serverUpdateProhibited +Domain Status: clientTransferProhibited +Domain Status: serverTransferProhibited +Registrant ID: cnnic-zdmd-022 +Registrant: Google Ireland Holdings +Registrant Contact Email: dns-admin@google.com +Sponsoring Registrar: MarkMonitor Inc. +Name Server: ns2.google.com +Name Server: ns1.google.com +Name Server: ns3.google.com +Name Server: ns4.google.com +Registration Date: 2003-03-17 12:20:05 +Expiration Date: 2015-03-17 12:48:36 +DNSSEC: unsigned + diff --git a/test/data/sina.com.cn b/test/data/sina.com.cn new file mode 100644 index 0000000..e6868ba --- /dev/null +++ b/test/data/sina.com.cn @@ -0,0 +1,20 @@ +Domain Name: sina.com.cn +ROID: 20021209s10011s00082127-cn +Domain Status: clientDeleteProhibited +Domain Status: serverDeleteProhibited +Domain Status: clientUpdateProhibited +Domain Status: serverUpdateProhibited +Domain Status: clientTransferProhibited +Domain Status: serverTransferProhibited +Registrant ID: sinacomcn2 +Registrant: 北京新浪互联信息服务有限公司 +Registrant Contact Email: domainname@staff.sina.com.cn +Sponsoring Registrar: 北京新网数码信息技术有限公司 +Name Server: ns3.sina.com.cn +Name Server: ns2.sina.com.cn +Name Server: ns4.sina.com.cn +Name Server: ns1.sina.com.cn +Registration Date: 1998-11-20 00:00:00 +Expiration Date: 2019-12-04 09:32:35 +DNSSEC: unsigned + diff --git a/test/target_default/google.cn b/test/target_default/google.cn new file mode 100644 index 0000000..c6a96bc --- /dev/null +++ b/test/target_default/google.cn @@ -0,0 +1 @@ +{"status": ["clientDeleteProhibited", "serverDeleteProhibited", "clientUpdateProhibited", "serverUpdateProhibited", "clientTransferProhibited", "serverTransferProhibited"], "contacts": {"admin": null, "tech": null, "registrant": {"handle": "cnnic-zdmd-022", "name": "Google Ireland Holdings", "email": "dns-admin@google.com"}, "billing": null}, "nameservers": ["ns2.google.com", "ns1.google.com", "ns3.google.com", "ns4.google.com"], "expiration_date": ["2015-03-17T12:48:36"], "creation_date": ["2003-03-17T12:20:05"], "raw": ["Domain Name: google.cn\nROID: 20030311s10001s00033735-cn\nDomain Status: clientDeleteProhibited\nDomain Status: serverDeleteProhibited\nDomain Status: clientUpdateProhibited\nDomain Status: serverUpdateProhibited\nDomain Status: clientTransferProhibited\nDomain Status: serverTransferProhibited\nRegistrant ID: cnnic-zdmd-022\nRegistrant: Google Ireland Holdings\nRegistrant Contact Email: dns-admin@google.com\nSponsoring Registrar: MarkMonitor Inc.\nName Server: ns2.google.com\nName Server: ns1.google.com\nName Server: ns3.google.com\nName Server: ns4.google.com\nRegistration Date: 2003-03-17 12:20:05\nExpiration Date: 2015-03-17 12:48:36\nDNSSEC: unsigned\n\n"], "registrar": ["MarkMonitor Inc."]} \ No newline at end of file diff --git a/test/target_default/sina.com.cn b/test/target_default/sina.com.cn new file mode 100644 index 0000000..c4fabb9 --- /dev/null +++ b/test/target_default/sina.com.cn @@ -0,0 +1 @@ +{"status": ["clientDeleteProhibited", "serverDeleteProhibited", "clientUpdateProhibited", "serverUpdateProhibited", "clientTransferProhibited", "serverTransferProhibited"], "contacts": {"admin": null, "tech": null, "registrant": {"handle": "sinacomcn2", "name": "\u5317\u4eac\u65b0\u6d6a\u4e92\u8054\u4fe1\u606f\u670d\u52a1\u6709\u9650\u516c\u53f8", "email": "domainname@staff.sina.com.cn"}, "billing": null}, "nameservers": ["ns3.sina.com.cn", "ns2.sina.com.cn", "ns4.sina.com.cn", "ns1.sina.com.cn"], "expiration_date": ["2019-12-04T09:32:35"], "creation_date": ["1998-11-20T00:00:00"], "raw": ["Domain Name: sina.com.cn\nROID: 20021209s10011s00082127-cn\nDomain Status: clientDeleteProhibited\nDomain Status: serverDeleteProhibited\nDomain Status: clientUpdateProhibited\nDomain Status: serverUpdateProhibited\nDomain Status: clientTransferProhibited\nDomain Status: serverTransferProhibited\nRegistrant ID: sinacomcn2\nRegistrant: \u5317\u4eac\u65b0\u6d6a\u4e92\u8054\u4fe1\u606f\u670d\u52a1\u6709\u9650\u516c\u53f8\nRegistrant Contact Email: domainname@staff.sina.com.cn\nSponsoring Registrar: \u5317\u4eac\u65b0\u7f51\u6570\u7801\u4fe1\u606f\u6280\u672f\u6709\u9650\u516c\u53f8\nName Server: ns3.sina.com.cn\nName Server: ns2.sina.com.cn\nName Server: ns4.sina.com.cn\nName Server: ns1.sina.com.cn\nRegistration Date: 1998-11-20 00:00:00\nExpiration Date: 2019-12-04 09:32:35\nDNSSEC: unsigned\n\n"], "registrar": ["\u5317\u4eac\u65b0\u7f51\u6570\u7801\u4fe1\u606f\u6280\u672f\u6709\u9650\u516c\u53f8"]} \ No newline at end of file diff --git a/test/target_normalized/google.cn b/test/target_normalized/google.cn new file mode 100644 index 0000000..c6a96bc --- /dev/null +++ b/test/target_normalized/google.cn @@ -0,0 +1 @@ +{"status": ["clientDeleteProhibited", "serverDeleteProhibited", "clientUpdateProhibited", "serverUpdateProhibited", "clientTransferProhibited", "serverTransferProhibited"], "contacts": {"admin": null, "tech": null, "registrant": {"handle": "cnnic-zdmd-022", "name": "Google Ireland Holdings", "email": "dns-admin@google.com"}, "billing": null}, "nameservers": ["ns2.google.com", "ns1.google.com", "ns3.google.com", "ns4.google.com"], "expiration_date": ["2015-03-17T12:48:36"], "creation_date": ["2003-03-17T12:20:05"], "raw": ["Domain Name: google.cn\nROID: 20030311s10001s00033735-cn\nDomain Status: clientDeleteProhibited\nDomain Status: serverDeleteProhibited\nDomain Status: clientUpdateProhibited\nDomain Status: serverUpdateProhibited\nDomain Status: clientTransferProhibited\nDomain Status: serverTransferProhibited\nRegistrant ID: cnnic-zdmd-022\nRegistrant: Google Ireland Holdings\nRegistrant Contact Email: dns-admin@google.com\nSponsoring Registrar: MarkMonitor Inc.\nName Server: ns2.google.com\nName Server: ns1.google.com\nName Server: ns3.google.com\nName Server: ns4.google.com\nRegistration Date: 2003-03-17 12:20:05\nExpiration Date: 2015-03-17 12:48:36\nDNSSEC: unsigned\n\n"], "registrar": ["MarkMonitor Inc."]} \ No newline at end of file diff --git a/test/target_normalized/sina.com.cn b/test/target_normalized/sina.com.cn new file mode 100644 index 0000000..c4fabb9 --- /dev/null +++ b/test/target_normalized/sina.com.cn @@ -0,0 +1 @@ +{"status": ["clientDeleteProhibited", "serverDeleteProhibited", "clientUpdateProhibited", "serverUpdateProhibited", "clientTransferProhibited", "serverTransferProhibited"], "contacts": {"admin": null, "tech": null, "registrant": {"handle": "sinacomcn2", "name": "\u5317\u4eac\u65b0\u6d6a\u4e92\u8054\u4fe1\u606f\u670d\u52a1\u6709\u9650\u516c\u53f8", "email": "domainname@staff.sina.com.cn"}, "billing": null}, "nameservers": ["ns3.sina.com.cn", "ns2.sina.com.cn", "ns4.sina.com.cn", "ns1.sina.com.cn"], "expiration_date": ["2019-12-04T09:32:35"], "creation_date": ["1998-11-20T00:00:00"], "raw": ["Domain Name: sina.com.cn\nROID: 20021209s10011s00082127-cn\nDomain Status: clientDeleteProhibited\nDomain Status: serverDeleteProhibited\nDomain Status: clientUpdateProhibited\nDomain Status: serverUpdateProhibited\nDomain Status: clientTransferProhibited\nDomain Status: serverTransferProhibited\nRegistrant ID: sinacomcn2\nRegistrant: \u5317\u4eac\u65b0\u6d6a\u4e92\u8054\u4fe1\u606f\u670d\u52a1\u6709\u9650\u516c\u53f8\nRegistrant Contact Email: domainname@staff.sina.com.cn\nSponsoring Registrar: \u5317\u4eac\u65b0\u7f51\u6570\u7801\u4fe1\u606f\u6280\u672f\u6709\u9650\u516c\u53f8\nName Server: ns3.sina.com.cn\nName Server: ns2.sina.com.cn\nName Server: ns4.sina.com.cn\nName Server: ns1.sina.com.cn\nRegistration Date: 1998-11-20 00:00:00\nExpiration Date: 2019-12-04 09:32:35\nDNSSEC: unsigned\n\n"], "registrar": ["\u5317\u4eac\u65b0\u7f51\u6570\u7801\u4fe1\u606f\u6280\u672f\u6709\u9650\u516c\u53f8"]} \ No newline at end of file