Skip to content
Snippets Groups Projects
Select Git revision
  • 97cf413db4539f85244838df92fdebad00bac668
  • master default
  • v2.21.0
  • v2.20.1
  • v2.20.0
  • v2.19.0
  • v2.18.1
  • v2.18.0
  • v2.17.0
  • v2.16.0
  • v2.15.0
  • v2.14.0
  • v2.13.1
  • v2.13.0
  • v2.12.0
  • v2.11.0
  • v2.10.0
  • v2.9.0
  • v2.8.0
  • v2.7.0
  • v2.6.0
  • v2.5.0
22 results

StorageLeaf.py

Blame
  • JsonService.py 465 B
    import json
    from typing import Dict
    
    from TheCodeLabs_BaseUtils.MultiCacheKeyService import MultiCacheKeyService
    
    
    class JsonService(MultiCacheKeyService):
        """
        Fetches information from a given json file.
        """
    
        EXAMPLE_SETTINGS = {
            "path": "path/to/my/file.json"
        }
    
        def _fetch_data(self, settings: Dict) -> Dict:
            with open(settings['path'], encoding='utf-8') as f:
                data = json.load(f)
            return {'data': data}