AutoTriageUtils.py 文件源码

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

项目:AutoTriageBot 作者: salesforce 项目源码 文件源码
def isProgramURL(url: str, acceptAll=True) -> bool:
    """ Whether the given url is a program URL """
    domain = urlparse(url).netloc.split(':')[0].lower()
    if not config.domains:
        return True
    if config.domains or (not acceptAll):
        try:
            ip = socket.gethostbyname(domain)
        except (socket.gaierror, UnicodeError):
            ip = None
        if domain and isinstance(config.domains, list):
            return (any([domain.endswith(hostname.lower()) for hostname in config.domains]) and
                    ip != '127.0.0.1')
        return False
    if acceptAll:
        return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号