def handle_info(self, data): '''Socket command: get the capabilities of a Swift cluster. :param data: a string of the form "[cluster_url]" :returns: a single-line JSON representation of the /info response ''' url = config.scheme_netloc_only(data) return json.dumps(self.get_info(url))
def info(self): url = scheme_netloc_only(self.base_url) + '/info' LOGGER.info('Getting capabilities for %s', url) resp = requests.get(url) if resp.status_code // 100 != 2: raise exceptions.SwiftClientError(resp) result = resp.json() result.setdefault('timestamp', time.time()) return result