mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
Broad exception fixed
This commit is contained in:
+2
-2
@@ -432,7 +432,7 @@ def dotted_netmask(mask):
|
||||
def is_ipv4_address(string_ip):
|
||||
try:
|
||||
socket.inet_aton(string_ip)
|
||||
except BaseException:
|
||||
except socket.error:
|
||||
return False
|
||||
return True
|
||||
|
||||
@@ -442,7 +442,7 @@ def is_ipv4_network(string_network):
|
||||
if '/' in string_network:
|
||||
try:
|
||||
socket.inet_aton(string_network.split('/')[0])
|
||||
except OSError:
|
||||
except socket.error:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user