Skip to content

Commit

Permalink
Fix isPrivateIp exception error by using ipaddress lib instead of net…
Browse files Browse the repository at this point in the history
…addr
  • Loading branch information
kuettai committed Dec 4, 2024
1 parent 760abad commit 4719b2e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/Tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pprint import pprint
from utils.Config import Config
from typing import Set, Dict, Union
from netaddr import IPAddress
from ipaddress import ip_address as IPAddress
from functools import lru_cache
from functools import lru_cache
from functools import lru_cache
Expand Down Expand Up @@ -40,7 +40,7 @@ def checkIsPrivateIp(ipaddr):
if ip[0] == '0.0.0.0':
return False

return IPAddress(ip[0]).is_private()
return IPAddress(ip[0]).is_private
except ValueError as e:
raise ValueError(f"Invalid IP address format: {ip_addr}") from e

Expand Down

0 comments on commit 4719b2e

Please sign in to comment.