Add dns_utils.get_ns()

This commit is contained in:
Son NK 2020-11-16 19:16:06 +01:00
parent 75ba1669e0
commit 1926408a13
2 changed files with 9 additions and 0 deletions

View File

@ -12,6 +12,14 @@ def _get_dns_resolver():
return my_resolver
def get_ns(hostname) -> [str]:
try:
answers = _get_dns_resolver().resolve(hostname, "NS")
except:
return []
return [a.to_text() for a in answers]
def get_cname_record(hostname) -> Optional[str]:
"""Return the CNAME record if exists for a domain, WITHOUT the trailing period at the end"""
try:

View File

@ -9,6 +9,7 @@ from app.config import (
ALIAS_DOMAINS,
PREMIUM_ALIAS_DOMAINS,
)
from app.dns_utils import get_ns
from app.email_utils import send_email, render, get_email_domain_part
from app.models import *
from job_runner import (