(self, method=None, url=None, response=None, error=None,
                  _pool=None, _stacktrace=None)
return new_retry
Return a new Retry object with incremented retry counters.

        :param response: A response object, or None, if the server did not
            return a response.
        :type response: :class:`~urllib3.response.HTTPResponse`
        :param Exception error: An error encountered during the request, or
            None if the response was received successfully.

        :return: A new ``Retry`` object.
Return a new Retry object with incremented retry counters.
Return a new Retry object with incremented retry counters .
def increment(self, method=None, url=None, response=None, error=None,
                  _pool=None, _stacktrace=None):
        """ Return a new Retry object with incremented retry counters.

        :param response: A response object, or None, if the server did not
            return a response.
        :type response: :class:`~urllib3.response.HTTPResponse`
        :param Exception error: An error encountered during the request, or
            None if the response was received successfully.

        :return: A new ``Retry`` object.
        """
        if self.total is False and error:
            # Disabled, indicate to re-raise the error.
            raise six.reraise(type(error), error, _stacktrace)

        total = self.total
        if total is not None:
            total -= 1

        connect = self.connect
        read = self.read
        redirect = self.redirect
        status_count = self.status
        cause = 'unknown'
        status = None
        redirect_location = None

        if error and self._is_connection_error(error):
            # Connect retry?
            if connect is False:
                raise six.reraise(type(error), error, _stacktrace)
            elif connect is not None:
                connect -= 1

        elif error and self._is_read_error(error):
            # Read retry?
            if read is False or not self._is_method_retryable(method):
                raise six.reraise(type(error), error, _stacktrace)
            elif read is not None:
                read -= 1

        elif response and response.get_redirect_location():
            # Redirect retry?
            if redirect is not None:
                redirect -= 1
            cause = 'too many redirects'
            redirect_location = response.get_redirect_location()
            status = response.status

        else:
            # Incrementing because of a server error like a 500 in
            # status_forcelist and a the given method is in the whitelist
            cause = ResponseError.GENERIC_ERROR
            if response and response.status:
                if status_count is not None:
                    status_count -= 1
                cause = ResponseError.SPECIFIC_ERROR.format(
                    status_code=response.status)
                status = response.status

        history = self.history + (RequestHistory(method, url, error, status, redirect_location),)

        new_retry = self.new(
            total=total,
            connect=connect, read=read, redirect=redirect, status=status_count,
            history=history)

        if new_retry.is_exhausted():
            raise MaxRetryError(_pool, url, error or ResponseError(cause))

        log.debug("Incremented Retry for (url='%s'): %r", url, new_retry)

        return new_retry
def increment ( self , method = None , url = None , response = None , error = None , _pool = None , _stacktrace = None ) : if self . total is False and error : # Disabled, indicate to re-raise the error. raise six . reraise ( type ( error ) , error , _stacktrace ) total = self . total if total is not None : total -= 1 connect = self . connect read = self . read redirect = self . redirect status_count = self . status cause = 'unknown' status = None redirect_location = None if error and self . _is_connection_error ( error ) : # Connect retry? if connect is False : raise six . reraise ( type ( error ) , error , _stacktrace ) elif connect is not None : connect -= 1 elif error and self . _is_read_error ( error ) : # Read retry? if read is False or not self . _is_method_retryable ( method ) : raise six . reraise ( type ( error ) , error , _stacktrace ) elif read is not None : read -= 1 elif response and response . get_redirect_location ( ) : # Redirect retry? if redirect is not None : redirect -= 1 cause = 'too many redirects' redirect_location = response . get_redirect_location ( ) status = response . status else : # Incrementing because of a server error like a 500 in # status_forcelist and a the given method is in the whitelist cause = ResponseError . GENERIC_ERROR if response and response . status : if status_count is not None : status_count -= 1 cause = ResponseError . SPECIFIC_ERROR . format ( status_code = response . status ) status = response . status history = self . history + ( RequestHistory ( method , url , error , status , redirect_location ) , ) new_retry = self . new ( total = total , connect = connect , read = read , redirect = redirect , status = status_count , history = history ) if new_retry . is_exhausted ( ) : raise MaxRetryError ( _pool , url , error or ResponseError ( cause ) ) log . debug ( "Incremented Retry for (url='%s'): %r" , url , new_retry ) return new_retry