utils.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:invenio-stats 作者: inveniosoftware 项目源码 文件源码
def get_user():
    """User information.

    .. note::

       **Privacy note** A users IP address, user agent string, and user id
       (if logged in) is sent to a message queue, where it is stored for about
       5 minutes. The information is used to:

       - Detect robot visits from the user agent string.
       - Generate an anonymized visitor id (using a random salt per day).
       - Detect the users host contry based on the IP address.

       The information is then discarded.
    """
    return dict(
        ip_address=request.remote_addr,
        user_agent=request.user_agent.string,
        user_id=(
            current_user.get_id() if current_user.is_authenticated else None
        ),
    )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号