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:
		
							parent
							
								
									4a62308ab9
								
							
						
					
					
						commit
						dd80275354
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		|  | @ -43,7 +43,8 @@ class HumbugAPI(object): | ||||||
|             if not os.path.exists(api_key_file): |             if not os.path.exists(api_key_file): | ||||||
|                 raise RuntimeError("api_key not specified and %s does not exist" |                 raise RuntimeError("api_key not specified and %s does not exist" | ||||||
|                                    % (api_key_file,)) |                                    % (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.api_key = api_key | ||||||
|         self.email = email |         self.email = email | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Keegan McAllister
						Keegan McAllister