From 58851f40d6f13a04b58a9b02b3bc8aafcfd67671 Mon Sep 17 00:00:00 2001 From: Florian Bezannier Date: Sun, 21 Mar 2021 19:52:16 +0100 Subject: [PATCH] add filename parameter to load otp config --- otp/Otp.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/otp/Otp.py b/otp/Otp.py index 5191195..c8d3517 100644 --- a/otp/Otp.py +++ b/otp/Otp.py @@ -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())