Fix logging and add new make dir function
This commit is contained in:
parent
8289a93830
commit
98f6d4516e
1 changed files with 13 additions and 4 deletions
|
@ -4,6 +4,7 @@ import tarfile
|
|||
import hashlib
|
||||
import geoip2.database
|
||||
import logging
|
||||
|
||||
from functools import update_wrapper
|
||||
from json.decoder import JSONDecodeError
|
||||
from os.path import abspath, join
|
||||
|
@ -67,13 +68,21 @@ def connection_handler(session, request, verify):
|
|||
try:
|
||||
return_json = get.json()
|
||||
except JSONDecodeError:
|
||||
logger.info('No JSON response... BORKED! Let us know in discord')
|
||||
logger.error('No JSON response... BORKED! Let us know in discord')
|
||||
|
||||
except InvalidSchema:
|
||||
logger.info('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:
|
||||
logger.info('Either your host is unreachable or you have an ssl issue.')
|
||||
logger.info('The issue was: {}'.format(e))
|
||||
logger.error('Either your host is unreachable or you have an SSL issue. : %s', e)
|
||||
|
||||
return return_json
|
||||
|
||||
|
||||
def mkdir_p(path):
|
||||
"""http://stackoverflow.com/a/600612/190597 (tzot)"""
|
||||
try:
|
||||
logger.info('Creating folder %s ', path)
|
||||
os.makedirs(path, exist_ok=True)
|
||||
except Exception as e:
|
||||
logger.error('Could not create folder %s : %s ', path, e)
|
||||
|
|
Loading…
Reference in a new issue