Handle domains without TLD

This commit is contained in:
Erin Song 2024-09-24 11:01:53 -07:00
parent 3f7dbd5f6e
commit 919fbbfd2f
No known key found for this signature in database
2 changed files with 44 additions and 0 deletions

View file

@ -108,6 +108,10 @@ def rdap(request, domain=""):
Domain = apps.get_model("registrar.Domain")
domain = request.GET.get("domain", "")
# If inputted domain doesn't have a TLD, append .gov to it
if "." not in domain:
domain = f"{domain}.gov"
rdap_data = requests.get(RDAP_URL.format(domain=domain)).json()
return JsonResponse(rdap_data)