kvstore.py
def get(self, k, wait=False, wait_index=False, timeout='5m'):
        """Get the value of a given key"""
        k = k.lstrip('/')
        url = '{}/{}'.format(self.endpoint, k)
        params = {}
        if wait:
            params['index'] = wait_index
            params['wait'] = timeout
        r = requests.get(url, params=params)
        if r.status_code == 404:
            raise KeyDoesNotExist("Key " + k + " does not exist")
        if r.status_code != 200:
            raise KVStoreError('GET returned {}'.format(r.status_code))

        try:
            return base64.b64decode(r.json()[0]['Value'])
        except TypeError as e:
            # Value was empty and wild None appeared
            return ""
def get(self, k, wait=False, wait_index=False, timeout='5m'):
        k = k.lstrip('/')
        url = '{}/{}'.format(self.endpoint, k)
        params = {}
        if wait:
            params['index'] = wait_index
            params['wait'] = timeout
        r = requests.get(url, params=params)
        if r.status_code == 404:
            raise KeyDoesNotExist("Key " + k + " does not exist")
        if r.status_code != 200:
            raise KVStoreError('GET returned {}'.format(r.status_code))

        try:
            return base64.b64decode(r.json()[0]['Value'])
        except TypeError as e:
            # Value was empty and wild None appeared
            return ""
def get ( self , k , wait = False , wait_index = False , timeout = '5m' ) : k = k . lstrip ( '/' ) url = '{}/{}' . format ( self . endpoint , k ) params = { } if wait : params [ 'index' ] = wait_index params [ 'wait' ] = timeout r = requests . get ( url , params = params ) if r . status_code == 404 : raise KeyDoesNotExist ( "Key " + k + " does not exist" ) if r . status_code != 200 : raise KVStoreError ( 'GET returned {}' . format ( r . status_code ) ) try : return base64 . b64decode ( r . json ( ) [ 0 ] [ 'Value' ] ) except TypeError as e : # Value was empty and wild None appeared return ""
Get the value of a given key
Get the value of a given key