def get_user_info(self, request):
        """
        Requires Flask-Login (https://pypi.python.org/pypi/Flask-Login/)
        to be installed and setup.
        """
        user_info = {}

        try:
            ip_address = request.access_route[0]
        except IndexError:
            ip_address = request.remote_addr

        if ip_address:
            user_info['ip_address'] = ip_address

        if not has_flask_login:
            return user_info

        if not hasattr(current_app, 'login_manager'):
            return user_info

        try:
            is_authenticated = current_user.is_authenticated
        except AttributeError:
            # HACK: catch the attribute error thrown by flask-login is not attached
            # >   current_user = LocalProxy(lambda: _request_ctx_stack.top.user)
            # E   AttributeError: 'RequestContext' object has no attribute 'user'
            return user_info

        if callable(is_authenticated):
            is_authenticated = is_authenticated()

        if not is_authenticated:
            return user_info

        user_info['id'] = current_user.get_id()

        if 'SENTRY_USER_ATTRS' in current_app.config:
            for attr in current_app.config['SENTRY_USER_ATTRS']:
                if hasattr(current_user, attr):
                    user_info[attr] = getattr(current_user, attr)

        return user_info
def get_user_info ( self , request ) : user_info = { } try : ip_address = request . access_route [ 0 ] except IndexError : ip_address = request . remote_addr if ip_address : user_info [ 'ip_address' ] = ip_address if not has_flask_login : return user_info if not hasattr ( current_app , 'login_manager' ) : return user_info try : is_authenticated = current_user . is_authenticated except AttributeError : return user_info if callable ( is_authenticated ) : is_authenticated = is_authenticated ( ) if not is_authenticated : return user_info user_info [ 'id' ] = current_user . get_id ( ) if 'SENTRY_USER_ATTRS' in current_app . config : for attr in current_app . config [ 'SENTRY_USER_ATTRS' ] : if hasattr ( current_user , attr ) : user_info [ attr ] = getattr ( current_user , attr ) return user_info
Requires Flask-Login (https://pypi.python.org/pypi/Flask-Login/)
        to be installed and setup.