api/common.py: Ensure that the API key file is closed when we're done with it

(imported from commit 87a0feb52952aa76bec041d032027e7a272156fc)
This commit is contained in:
Keegan McAllister 2012-11-26 12:21:09 -05:00
parent 4a62308ab9
commit dd80275354

View file

@ -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