mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-21 20:09:23 +02:00
Make login not required to access available API
This commit is contained in:
parent
ff44ee2f1e
commit
9c7bbd31ec
1 changed files with 11 additions and 5 deletions
|
@ -5,6 +5,8 @@ from django.http import JsonResponse
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
from login_required import login_not_required
|
||||||
|
|
||||||
from cachetools.func import ttl_cache
|
from cachetools.func import ttl_cache
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,14 +60,18 @@ def check_domain_available(domain):
|
||||||
a match.
|
a match.
|
||||||
"""
|
"""
|
||||||
Domain = apps.get_model("registrar.Domain")
|
Domain = apps.get_model("registrar.Domain")
|
||||||
if domain.endswith(".gov"):
|
try:
|
||||||
return Domain.available(domain)
|
if domain.endswith(".gov"):
|
||||||
else:
|
return Domain.available(domain)
|
||||||
# domain search string doesn't end with .gov, add it on here
|
else:
|
||||||
return Domain.available(domain + ".gov")
|
# domain search string doesn't end with .gov, add it on here
|
||||||
|
return Domain.available(domain + ".gov")
|
||||||
|
except:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
@require_http_methods(["GET"])
|
@require_http_methods(["GET"])
|
||||||
|
@login_not_required
|
||||||
def available(request, domain=""):
|
def available(request, domain=""):
|
||||||
"""Is a given domain available or not.
|
"""Is a given domain available or not.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue