commit a51918d2ac1c28bd48f01c1069335caf2132fa90 parent 1e51d690bcc9289f9f2cbbf20e5cdd5709a55a70 Author: Sheng <webmaster0115@gmail.com> Date: Mon, 15 Oct 2018 17:20:30 +0800 Added to_ip_address to utils Diffstat:
M | webssh/utils.py | | | 7 | +++++-- |
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/webssh/utils.py b/webssh/utils.py @@ -30,10 +30,13 @@ def to_int(string): pass +def to_ip_address(ipstr): + return ipaddress.ip_address(to_str(ipstr)) + + def is_valid_ip_address(ipstr): - ipstr = to_str(ipstr) try: - ipaddress.ip_address(ipstr) + to_ip_address(ipstr) except ValueError: return False return True