Add support for htdigest auth when using CORE webservices API
This commit is contained in:
		
							parent
							
								
									66a6c8f5a0
								
							
						
					
					
						commit
						e838e5b514
					
				
					 1 changed files with 12 additions and 2 deletions
				
			
		|  | @ -2,7 +2,7 @@ | |||
| ################################################################################ | ||||
| # | ||||
| #  Rattail -- Retail Software Framework | ||||
| #  Copyright © 2010-2021 Lance Edgar | ||||
| #  Copyright © 2010-2023 Lance Edgar | ||||
| # | ||||
| #  This file is part of Rattail. | ||||
| # | ||||
|  | @ -24,6 +24,8 @@ | |||
| CORE-POS API | ||||
| """ | ||||
| 
 | ||||
| from requests.auth import HTTPDigestAuth | ||||
| 
 | ||||
| from corepos.api import CoreWebAPI | ||||
| 
 | ||||
| 
 | ||||
|  | @ -32,4 +34,12 @@ def make_corepos_api(config): | |||
|     Make and return a new CORE-POS API client object. | ||||
|     """ | ||||
|     url = config.require('corepos.api', 'url') | ||||
|     return CoreWebAPI(url) | ||||
| 
 | ||||
|     kwargs = {} | ||||
|     username = config.get('corepos.api', 'htdigest.username') | ||||
|     password = config.get('corepos.api', 'htdigest.password') | ||||
|     if username and password: | ||||
|         kwargs['htdigest_username'] = username | ||||
|         kwargs['htdigest_password'] = password | ||||
| 
 | ||||
|     return CoreWebAPI(url, **kwargs) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lance Edgar
						Lance Edgar