authentication-function/src/localstorage.py [5:31]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FILE_PATH = '/smart-cooler/shelve' # Raspberry pi


class LocalStorage:
    def read(self, key):
        try:
            s = shelve.open(FILE_PATH)
            data = s[key]
            s.close()
            return data
        except:
            return {}

    def write(self, data):
        s = shelve.open(FILE_PATH, writeback=True)
        for key, value in data.items():
            s[key] = value
        s.close()
        return True

    def clear(self, key):
        try:
            s = shelve.open(FILE_PATH)
            del s[key]
            return True
        except:
            return False
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



qr-monitoring-function/src/localstorage.py [5:31]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FILE_PATH = '/smart-cooler/shelve' # Raspberry pi


class LocalStorage:
    def read(self, key):
        try:
            s = shelve.open(FILE_PATH)
            data = s[key]
            s.close()
            return data
        except:
            return {}

    def write(self, data):
        s = shelve.open(FILE_PATH, writeback=True)
        for key, value in data.items():
            s[key] = value
        s.close()
        return True

    def clear(self, key):
        try:
            s = shelve.open(FILE_PATH)
            del s[key]
            return True
        except:
            return False
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



