diff --git a/webssh/utils.py b/webssh/utils.py index 51f4d39..5c832c6 100644 --- 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