

def perform_request(self, method, url, params=None, body=None, timeout=None, ignore=()):
    mc = self._get_connection()
    url = (self.url_prefix + url)
    if params:
        url = ('%s?%s' % (url, urlencode((params or {
            
        }))))
    full_url = (self.host + url)
    mc_method = self.method_map.get(method, 'get')
    start = time.time()
    try:
        status = 200
        if (mc_method == 'set'):
            response = ''
            if (not json.dumps(mc.set(url, body))):
                status = 500
        else:
            response = mc.get(url)
        duration = (time.time() - start)
        if response:
            response = response.decode('utf-8')
    except Exception as e:
        self.log_request_fail(method, full_url, body, (time.time() - start), exception=e)
        raise ConnectionError('N/A', str(e), e)
    finally:
        self._release_connection(mc)
    if (response and (response[0] == '{') and (('"status"' in response) or ('"error"' in response))):
        data = json.loads(response)
        if (('status' in data) and isinstance(data['status'], int)):
            status = data['status']
        elif ('error' in data):
            raise TransportError('N/A', data['error'])
    if ((not (200 <= status < 300)) and (status not in ignore)):
        self.log_request_fail(method, url, body, duration, status)
        self._raise_error(status, response)
    self.log_request_success(method, full_url, url, body, status, response, duration)
    return (status, {
        
    }, response)

dataset/ETHPy150Open KunihikoKido/sublime-elasticsearch-client/lib/elasticsearch/connection/memcached.py MemcachedConnection.perform_request/original