whois/whois.py
changeset 133 29e9190319e5
parent 124 dfa8657bdefc
child 134 3ff7f09ea24a
equal deleted inserted replaced
131:193a62737030 133:29e9190319e5
    57     BNICHOST = "whois.registro.br"
    57     BNICHOST = "whois.registro.br"
    58     NORIDHOST = "whois.norid.no"
    58     NORIDHOST = "whois.norid.no"
    59     IANAHOST = "whois.iana.org"
    59     IANAHOST = "whois.iana.org"
    60     PANDIHOST = "whois.pandi.or.id"
    60     PANDIHOST = "whois.pandi.or.id"
    61     DENICHOST = "de.whois-servers.net"
    61     DENICHOST = "de.whois-servers.net"
       
    62     AI_HOST = "whois.ai"
    62     DEFAULT_PORT = "nicname"
    63     DEFAULT_PORT = "nicname"
    63 
    64 
    64     WHOIS_RECURSE = 0x01
    65     WHOIS_RECURSE = 0x01
    65     WHOIS_QUICK = 0x02
    66     WHOIS_QUICK = 0x02
    66 
    67 
   150         if len(domain) < 2:
   151         if len(domain) < 2:
   151             return None
   152             return None
   152         tld = domain[-1]
   153         tld = domain[-1]
   153         if tld[0].isdigit():
   154         if tld[0].isdigit():
   154             return NICClient.ANICHOST
   155             return NICClient.ANICHOST
   155         return tld + NICClient.QNICHOST_TAIL
   156         elif tld == 'ai':
       
   157             return NICClient.AI_HOST
       
   158         else:
       
   159             return tld + NICClient.QNICHOST_TAIL
   156 
   160 
   157     def whois_lookup(self, options, query_arg, flags):
   161     def whois_lookup(self, options, query_arg, flags):
   158         """Main entry point: Perform initial lookup on TLD whois server,
   162         """Main entry point: Perform initial lookup on TLD whois server,
   159         or other server to get region-specific whois server, then if quick
   163         or other server to get region-specific whois server, then if quick
   160         flag is false, perform a second lookup on the region-specific
   164         flag is false, perform a second lookup on the region-specific