mirror of
				https://github.com/searxng/searxng.git
				synced 2025-10-30 18:22:31 -04:00 
			
		
		
		
	Instead of loading the data/*.json in different location, load these files in the new searx.data module.
		
			
				
	
	
		
			22 lines
		
	
	
		
			481 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			481 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| import json
 | |
| from pathlib import Path
 | |
| 
 | |
| 
 | |
| __init__ = ['ENGINES_LANGUGAGES', 'CURRENCIES', 'USER_AGENTS', 'bangs_loader']
 | |
| data_dir = Path(__file__).parent
 | |
| 
 | |
| 
 | |
| def load(filename):
 | |
|     # add str(...) for Python 3.5
 | |
|     with open(str(data_dir / filename), encoding='utf-8') as fd:
 | |
|         return json.load(fd)
 | |
| 
 | |
| 
 | |
| def bangs_loader():
 | |
|     return load('bangs.json')
 | |
| 
 | |
| 
 | |
| ENGINES_LANGUAGES = load('engines_languages.json')
 | |
| CURRENCIES = load('currencies.json')
 | |
| USER_AGENTS = load('useragents.json')
 |