From dd80275354054ccfc5873165d940eef69919adfb Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Mon, 26 Nov 2012 12:21:09 -0500 Subject: [PATCH] api/common.py: Ensure that the API key file is closed when we're done with it (imported from commit 87a0feb52952aa76bec041d032027e7a272156fc) --- common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common.py b/common.py index 64dd40d..0171480 100644 --- a/common.py +++ b/common.py @@ -43,7 +43,8 @@ class HumbugAPI(object): if not os.path.exists(api_key_file): raise RuntimeError("api_key not specified and %s does not exist" % (api_key_file,)) - api_key = file(api_key_file).read().strip() + with file(api_key_file, 'r') as f: + api_key = f.read().strip() self.api_key = api_key self.email = email