auth.py 文件源码

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

项目:django-heartbeat 作者: pbs 项目源码 文件源码
def is_authorized(ip, authorized_ips):
    ip = ip_address(ip)

    for item in authorized_ips:
        try:
            if ip == ip_address(item):
                return True
        except ValueError:
            try:
                if ip in ip_network(item):
                    return True
            except ValueError:
                logger.warn('The "authorized_ip" list (settings.HEARTBEAT)'
                            'contains an item that is neither an ip address '
                            'nor an ip network: {}'.format(item))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号