parsedmarc/utils.py
def get_ip_address_info(ip_address, cache=None, nameservers=None,
                        timeout=2.0, parallel=False):
    """
    Returns reverse DNS and country information for the given IP address

    Args:
        ip_address (str): The IP address to check
        cache (ExpiringDict): Cache storage
        nameservers (list): A list of one or more nameservers to use
        (Cloudflare's public DNS resolvers by default)
        timeout (float): Sets the DNS timeout in seconds
        parallel (bool): parallel processing

    Returns:
        OrderedDict: ``ip_address``, ``reverse_dns``

    """
    ip_address = ip_address.lower()
    if cache:
        info = cache.get(ip_address, None)
        if info:
            return info
    info = OrderedDict()
    info["ip_address"] = ip_address
    reverse_dns = get_reverse_dns(ip_address,
                                  nameservers=nameservers,
                                  timeout=timeout)
    country = get_ip_address_country(ip_address, parallel=parallel)
    info["country"] = country
    info["reverse_dns"] = reverse_dns
    info["base_domain"] = None
    if reverse_dns is not None:
        base_domain = get_base_domain(reverse_dns)
        info["base_domain"] = base_domain

    return info
def get_ip_address_info(ip_address, cache=None, nameservers=None,
                        timeout=2.0, parallel=False):
    ip_address = ip_address.lower()
    if cache:
        info = cache.get(ip_address, None)
        if info:
            return info
    info = OrderedDict()
    info["ip_address"] = ip_address
    reverse_dns = get_reverse_dns(ip_address,
                                  nameservers=nameservers,
                                  timeout=timeout)
    country = get_ip_address_country(ip_address, parallel=parallel)
    info["country"] = country
    info["reverse_dns"] = reverse_dns
    info["base_domain"] = None
    if reverse_dns is not None:
        base_domain = get_base_domain(reverse_dns)
        info["base_domain"] = base_domain

    return info
def get_ip_address_info ( ip_address , cache = None , nameservers = None , timeout = 2.0 , parallel = False ) : ip_address = ip_address . lower ( ) if cache : info = cache . get ( ip_address , None ) if info : return info info = OrderedDict ( ) info [ "ip_address" ] = ip_address reverse_dns = get_reverse_dns ( ip_address , nameservers = nameservers , timeout = timeout ) country = get_ip_address_country ( ip_address , parallel = parallel ) info [ "country" ] = country info [ "reverse_dns" ] = reverse_dns info [ "base_domain" ] = None if reverse_dns is not None : base_domain = get_base_domain ( reverse_dns ) info [ "base_domain" ] = base_domain return info
Returns reverse DNS and country information for the given IP address

    Args:
        ip_address (str): The IP address to check
        cache (ExpiringDict): Cache storage
        nameservers (list): A list of one or more nameservers to use
        (Cloudflare's public DNS resolvers by default)
        timeout (float): Sets the DNS timeout in seconds
        parallel (bool): parallel processing

    Returns:
        OrderedDict: ``ip_address``, ``reverse_dns``
Returns reverse DNS and country information for the given IP address