From ebc9e4fc7466da61372f71eea74c8bd7cd4fae1f Mon Sep 17 00:00:00 2001 From: Jakob Schlyter Date: Wed, 13 May 2020 21:03:36 +0200 Subject: [PATCH] close file after access --- src/cryptojwt/key_bundle.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cryptojwt/key_bundle.py b/src/cryptojwt/key_bundle.py index efedd85c..f4d7b0dd 100755 --- a/src/cryptojwt/key_bundle.py +++ b/src/cryptojwt/key_bundle.py @@ -290,7 +290,8 @@ def do_local_jwk(self, filename): :param filename: Name of the file from which the JWKS should be loaded """ - _info = json.loads(open(filename).read()) + with open(filename) as input_file: + _info = json.load(input_file) if 'keys' in _info: self.do_keys(_info["keys"]) else: