endpoints/axfr_gateway.py
def serial_query(domain, nameservers):
    """
    Get serial from one of the DNS masters
    """
    request = dns.message.make_query(domain, dns.rdatatype.SOA)
    for ns in nameservers:
        logging.info("asking nameserver: " + ns)
        try:
            req = dns.query.udp(request, ns)
            break
        except Exception as query_error:
            req = None
            logging.warning("nameserver threw an error: {}".format(query_error))
    if not req:
        logging.error("no nameserver returned a serial")
        return False
    try:
        ns_serial = int(req.answer[0].to_text().split()[-5:][0])
        return ns_serial
    except:
        logging.error("got invalid SOA record: {}".format(req.answer))
        return False

    Get serial from one of the DNS masters
    
Get serial from one of the DNS masters
Get serial from one of the DNS masters
def serial_query(domain, nameservers):
    request = dns.message.make_query(domain, dns.rdatatype.SOA)
    for ns in nameservers:
        logging.info("asking nameserver: " + ns)
        try:
            req = dns.query.udp(request, ns)
            break
        except Exception as query_error:
            req = None
            logging.warning("nameserver threw an error: {}".format(query_error))
    if not req:
        logging.error("no nameserver returned a serial")
        return False
    try:
        ns_serial = int(req.answer[0].to_text().split()[-5:][0])
        return ns_serial
    except:
        logging.error("got invalid SOA record: {}".format(req.answer))
        return False
def serial_query ( domain , nameservers ) : request = dns . message . make_query ( domain , dns . rdatatype . SOA ) for ns in nameservers : logging . info ( "asking nameserver: " + ns ) try : req = dns . query . udp ( request , ns ) break except Exception as query_error : req = None logging . warning ( "nameserver threw an error: {}" . format ( query_error ) ) if not req : logging . error ( "no nameserver returned a serial" ) return False try : ns_serial = int ( req . answer [ 0 ] . to_text ( ) . split ( ) [ - 5 : ] [ 0 ] ) return ns_serial except : logging . error ( "got invalid SOA record: {}" . format ( req . answer ) ) return False
Get serial from one of the DNS masters
Get serial from one of the DNS masters
"""
    Get serial from one of the DNS masters
    """
domain
nameservers