whois/parser.py
changeset 120 b4273400685e
parent 118 d024d2328e51
parent 119 3c7fbec18337
child 121 ccd653a54263
--- a/whois/parser.py	Mon Jan 09 17:39:24 2017 +0100
+++ b/whois/parser.py	Tue Jan 10 09:33:41 2017 +0800
@@ -46,6 +46,7 @@
     '%d/%m/%Y %H:%M:%S',     # 23/04/2015 12:00:07 EEST
     '%d/%m/%Y %H:%M:%S %Z',     # 23/04/2015 12:00:07 EEST
     '%d/%m/%Y %H:%M:%S.%f %Z',  # 23/04/2015 12:00:07.619546 EEST
+    '%B %d %Y',                 # August 14 2017
 ]
 
 
@@ -241,6 +242,12 @@
             return WhoisID(domain, text)
         elif domain.endswith('.sk'):
             return WhoisSK(domain, text)
+        elif domain.endswith('.se'):
+            return WhoisSe(domain, text)
+        elif domain.endswith('.nu'):
+            return WhoisSe(domain, text)
+        elif domain.endswith('.is'):
+            return WhoisIs(domain, text)
         else:
             return WhoisEntry(domain, text)
 
@@ -1130,3 +1137,45 @@
                 raise PywhoisError(text)
             else:
                 WhoisEntry.__init__(self, domain, text, self.regex)
+
+
+class WhoisSe(WhoisEntry):
+    """Whois parser for .se domains
+    """
+    regex = {
+        'domain_name':                    'domain\.*: *(.+)',
+        'creation_date':                  'created\.*: *(.+)',
+        'updated_date':                   'modified\.*: *(.+)',
+        'expiration_date':                'expires\.*: *(.+)',
+        'transfer_date':                  'transferred\.*: *(.+)',
+        'name_servers':                   'nserver\.*: *(.+)',  # list of name servers
+        'dnssec':                         'dnssec\.*: *(.+)',
+        'status':                         'status\.*: *(.+)',  # list of statuses
+        'registrar':                      'registrar: *(.+)',
+    }
+
+    def __init__(self, domain, text):
+        if 'not found.' in text:
+            raise PywhoisError(text)
+        else:
+            WhoisEntry.__init__(self, domain, text, self.regex)
+
+
+class WhoisIs(WhoisEntry):
+    """Whois parser for .se domains
+    """
+    regex = {
+        'domain_name':      'domain\.*: *(.+)',
+        'name':             'person\.*: *(.+)',
+        'address':          'address\.*: *(.+)',
+        'creation_date':    'created\.*: *(.+)',
+        'expiration_date':  'expires\.*: *(.+)',
+        'name_servers':     'nserver\.*: *(.+)',  # list of name servers
+        'dnssec':           'dnssec\.*: *(.+)',
+    }
+
+    def __init__(self, domain, text):
+        if 'No entries found' in text:
+            raise PywhoisError(text)
+        else:
+            WhoisEntry.__init__(self, domain, text, self.regex)