fix #106
This commit is contained in:
parent
f48bfa1193
commit
dc39185593
1 changed files with 5 additions and 6 deletions
|
@ -12,7 +12,7 @@ from urllib.request import urlretrieve
|
||||||
from json.decoder import JSONDecodeError
|
from json.decoder import JSONDecodeError
|
||||||
from os.path import abspath, join, basename, isdir
|
from os.path import abspath, join, basename, isdir
|
||||||
from urllib3.exceptions import InsecureRequestWarning
|
from urllib3.exceptions import InsecureRequestWarning
|
||||||
from requests.exceptions import InvalidSchema, SSLError, ConnectionError
|
from requests.exceptions import InvalidSchema, SSLError, ConnectionError, ChunkedEncodingError
|
||||||
|
|
||||||
logger = getLogger()
|
logger = getLogger()
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ class GeoIPHandler(object):
|
||||||
try:
|
try:
|
||||||
remove(self.dbfile)
|
remove(self.dbfile)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
self.logger.warn("Cannot remove GeoLite2 DB as it does not exsist!")
|
self.logger.warning("Cannot remove GeoLite2 DB as it does not exist!")
|
||||||
|
|
||||||
self.logger.debug("Opening GeoLite2 tar file : %s", tar_dbfile)
|
self.logger.debug("Opening GeoLite2 tar file : %s", tar_dbfile)
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ class GeoIPHandler(object):
|
||||||
remove(tar_dbfile)
|
remove(tar_dbfile)
|
||||||
self.logger.debug('Removed the GeoLite2 DB TAR file.')
|
self.logger.debug('Removed the GeoLite2 DB TAR file.')
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
self.logger.warn("Cannot remove GeoLite2 DB TAR file as it does not exsist!")
|
self.logger.warning("Cannot remove GeoLite2 DB TAR file as it does not exist!")
|
||||||
|
|
||||||
|
|
||||||
def hashit(string):
|
def hashit(string):
|
||||||
|
@ -156,17 +156,16 @@ def connection_handler(session, request, verify, as_is_reply=False):
|
||||||
return_json = get.json()
|
return_json = get.json()
|
||||||
except JSONDecodeError:
|
except JSONDecodeError:
|
||||||
logger.error('No JSON response. Response is: %s', get.text)
|
logger.error('No JSON response. Response is: %s', get.text)
|
||||||
|
|
||||||
if air:
|
if air:
|
||||||
return get
|
return get
|
||||||
except InvalidSchema:
|
except InvalidSchema:
|
||||||
logger.error("You added http(s):// in the config file. Don't do that.")
|
logger.error("You added http(s):// in the config file. Don't do that.")
|
||||||
|
|
||||||
except SSLError as e:
|
except SSLError as e:
|
||||||
logger.error('Either your host is unreachable or you have an SSL issue. : %s', e)
|
logger.error('Either your host is unreachable or you have an SSL issue. : %s', e)
|
||||||
|
|
||||||
except ConnectionError as e:
|
except ConnectionError as e:
|
||||||
logger.error('Cannot resolve the url/ip/port. Check connectivity. Error: %s', e)
|
logger.error('Cannot resolve the url/ip/port. Check connectivity. Error: %s', e)
|
||||||
|
except ChunkedEncodingError as e:
|
||||||
|
logger.error('Broken connection during request... oops? Error: %s', e)
|
||||||
|
|
||||||
return return_json
|
return return_json
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue