def error_rate(self):
        """Error rate: from 0 to 1.

        For example: 0.7 = 70% requests ends with error.

        :rtype: float

        .. versionadded:: 0.2.0
        """
        if not self.stat['requests']:
            return 0
        return round(
            sum(self.stat['errors'].values()) / self.stat['requests'], 2
        )
def error_rate ( self ) : if not self . stat [ 'requests' ] : return 0 return round ( sum ( self . stat [ 'errors' ] . values ( ) ) / self . stat [ 'requests' ] , 2 )
Error rate: from 0 to 1.

        For example: 0.7 = 70% requests ends with error.

        :rtype: float

        .. versionadded:: 0.2.0