Skip to content

Commit

Permalink
fix #106
Browse files Browse the repository at this point in the history
  • Loading branch information
dirtycajunrice committed Mar 12, 2019
1 parent a4910e8 commit c1e2d51
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions varken/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,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 requests.exceptions import InvalidSchema, SSLError, ConnectionError, ChunkedEncodingError

logger = getLogger()

Expand Down Expand Up @@ -98,7 +98,7 @@ def download(self):
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)

Expand All @@ -115,7 +115,7 @@ def download(self):
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):
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit c1e2d51

Please sign in to comment.