Home | Trees | Indices | Help |
---|
|
1 import re 24 if hostname[-1] == ".": 5 # strip exactly one dot from the right, if present 6 hostname = hostname[:-1] 7 if len(hostname) > 253: 8 return False 9 10 # must not be all-numeric, so that it can't be confused with an ip-address 11 if re.match(r"[\d.]+$", hostname): 12 return False 13 14 allowed = re.compile("(?!-)[A-Z\d-]{1,63}(?<!-)$", re.IGNORECASE) 15 return all(allowed.match(x) for x in hostname.split("."))16
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 | http://epydoc.sourceforge.net |