File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -2,4 +2,6 @@ requests~=2.24.0
22pycryptodome == 3.9.8
33responses == 0.10.15
44requests-mock == 1.8.0
5- pytest == 5.4.3
5+ pytest == 5.4.3
6+ setuptools ~= 49.6.0
7+ IPy ~= 1.0
Original file line number Diff line number Diff line change 11import ipaddress
22import re
3- import socket
3+ from IPy import IP
44
55
66class IpUtils (object ):
@@ -19,12 +19,12 @@ def is_ip_address(ip_address):
1919 def is_valid_public_ip (ip_address ):
2020 ip = ipaddress .ip_address (ip_address )
2121
22- if ip is ipaddress . IPv4Address :
23- if not ip .is_loopback and not ip .is_reserved and not ip .is_unspecified :
22+ if ip . version is 4 :
23+ if not ip .is_loopback and not ip .is_reserved and not ip .is_unspecified and IP ( ip_address ). iptype () is not "PRIVATE" :
2424 return True
2525 return False
2626
27- if not ip .is_unspecified :
27+ if not ip .is_unspecified and IP ( ip_address ). iptype () is not "PRIVATE" :
2828 return True
2929 return False
3030
You can’t perform that action at this time.
0 commit comments