def _perform_request(self, hosts, path, method, params=None, body=None,
                         is_search=False):
        """Perform an HTTPS request with retry logic."""
        if params:
            params = urlify(params)
        if body:
            body = json.dumps(body, cls=CustomJSONEncoder)
        timeout = self.search_timeout if is_search else self.timeout
        exceptions_hosts = {}
        for i, host in enumerate(hosts):
            if i > 1:
                if isinstance(timeout, tuple):
                    timeout = (timeout[0] + 2, timeout[1] + 10)
                else:
                    timeout += 10
            try:
                _request = APPENGINE and self._perform_appengine_request or self._perform_session_request
                return _request(host, path, method, timeout, params=params, data=body)
            except AlgoliaException as e:
                raise e
            except Exception as e:
                exceptions_hosts[host] = "%s: %s" % (e.__class__.__name__, str(e))
                pass

        # Impossible to connect
        raise AlgoliaException('%s %s' % ('Unreachable hosts:',
                               exceptions_hosts))
dataset/ETHPy150Open algolia/algoliasearch-client-python/algoliasearch/client.py/Client._perform_request/original