def get_key(self, key):
    url = '%(base)s/%(key)s' % {
      'base': self.url,
      'key': key
    }
    self.logger.debug('Getting url: ' + url)
    response = requests.get(url)
    self.logger.debug('Response: ' + response.text)

    res = json.loads(response.text)
    if isinstance(res, list):
      raise ValueError('Key "%s" is a directory, expecting leaf (use \
list_directory() to get directory listing).' % key)      

    #Check to see if Etcd returned an error
    if 'errorCode' in res:
      raise EtcdError(res['errorCode'], res['message']) 

    try:
      return str(res['node']['value'])
    except __HOLE__:
      #Fallback on v1 functionality
      return str(res['value'])
dataset/ETHPy150Open cholcombe973/autodock/etcd.py/Etcd.get_key