add filename parameter to load otp config

This commit is contained in:
Florian Bezannier
2021-03-21 19:52:16 +01:00
parent ce5b05301a
commit 58851f40d6
+4 -4
View File
@@ -295,14 +295,14 @@ def encode_oeap(text, key):
return cipher.encrypt(text)
def save_otp(obj):
with open("otp.bin", 'wb') as output:
def save_otp(obj, filename="otp.bin"):
with open(filename, 'wb') as output:
pickle.dump(obj, output)
def load_otp():
def load_otp(filename="otp.bin"):
try:
with open("otp.bin", 'rb') as input_file:
with open(filename, 'rb') as input_file:
return pickle.load(input_file)
except FileNotFoundError:
logger.debug(traceback.format_exc())