Better error checking for failback_ip
This commit is contained in:
parent
210e2d19c1
commit
bf20f84224
3 changed files with 24 additions and 3 deletions
|
@ -11,6 +11,7 @@ from json.decoder import JSONDecodeError
|
|||
from os.path import abspath, join, basename, isdir
|
||||
from urllib3.exceptions import InsecureRequestWarning
|
||||
from requests.exceptions import InvalidSchema, SSLError, ConnectionError
|
||||
from ipaddress import IPv4Address
|
||||
|
||||
logger = getLogger()
|
||||
|
||||
|
@ -83,6 +84,12 @@ def hashit(string):
|
|||
return hashed
|
||||
|
||||
|
||||
def rfc1918_ip_check(ip):
|
||||
rfc1918_ip = IPv4Address(ip).is_private
|
||||
|
||||
return rfc1918_ip
|
||||
|
||||
|
||||
def connection_handler(session, request, verify):
|
||||
s = session
|
||||
r = request
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue