This commit is contained in:
flaskfarm
2022-10-26 22:44:41 +09:00
parent 1595599a65
commit 24db9ff5c1
3 changed files with 26 additions and 21 deletions

View File

@@ -1 +1 @@
VERSION="4.0.40"
VERSION="4.0.41"

View File

@@ -31,6 +31,30 @@ class SupportFile(object):
logger.error('Exception:%s', exception)
logger.error(traceback.format_exc())
@classmethod
def read_json(cls, filepath):
try:
with open(filepath, "r", encoding='utf8') as json_file:
data = json.load(json_file)
return data
except Exception as exception:
logger.error('Exception:%s', exception)
logger.error(traceback.format_exc())
@classmethod
def write_json(cls, filepath, data):
try:
if os.path.dirname(filepath) != '':
os.makedirs(os.path.dirname(filepath), exist_ok=True)
with open(filepath, "w", encoding='utf8') as json_file:
json.dump(data, json_file, indent=4, ensure_ascii=False)
except Exception as exception:
logger.error('Exception:%s', exception)
logger.error(traceback.format_exc())
@classmethod
def download_file(cls, url, filepath):
@@ -244,26 +268,7 @@ class SupportFile(object):
return False
@classmethod
def write_json(cls, filepath, data):
try:
if os.path.dirname(filepath) != '':
os.makedirs(os.path.dirname(filepath), exist_ok=True)
with open(filepath, "w", encoding='utf8') as json_file:
json.dump(data, json_file, indent=4, ensure_ascii=False)
except Exception as exception:
logger.error('Exception:%s', exception)
logger.error(traceback.format_exc())
@classmethod
def read_json(cls, filepath):
try:
with open(filepath, "r", encoding='utf8') as json_file:
data = json.load(json_file)
return data
except Exception as exception:
logger.error('Exception:%s', exception)
logger.error(traceback.format_exc())

File diff suppressed because one or more lines are too long