Better error checking for failback_ip

This commit is contained in:
samwiseg0 2019-01-01 23:41:23 -05:00
parent 210e2d19c1
commit bf20f84224
3 changed files with 24 additions and 3 deletions

View file

@ -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