From dc3918559388daa5d6a61b652031f43974c3574e Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Mon, 11 Mar 2019 19:42:53 -0500 Subject: [PATCH] fix #106 --- varken/helpers.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/varken/helpers.py b/varken/helpers.py index ece4656..723f39d 100644 --- a/varken/helpers.py +++ b/varken/helpers.py @@ -12,7 +12,7 @@ from urllib.request import urlretrieve 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 requests.exceptions import InvalidSchema, SSLError, ConnectionError, ChunkedEncodingError logger = getLogger() @@ -98,7 +98,7 @@ class GeoIPHandler(object): try: remove(self.dbfile) 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) @@ -115,7 +115,7 @@ class GeoIPHandler(object): remove(tar_dbfile) self.logger.debug('Removed the GeoLite2 DB TAR file.') 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): @@ -156,17 +156,16 @@ def connection_handler(session, request, verify, as_is_reply=False): return_json = get.json() except JSONDecodeError: logger.error('No JSON response. Response is: %s', get.text) - if air: return get except InvalidSchema: logger.error("You added http(s):// in the config file. Don't do that.") - except SSLError as e: logger.error('Either your host is unreachable or you have an SSL issue. : %s', e) - except ConnectionError as 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