mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-19 10:59:21 +02:00
Remove old availability URL implementation
This commit is contained in:
parent
ea4b4e2dae
commit
2ab29b9f43
1 changed files with 0 additions and 25 deletions
|
@ -18,7 +18,6 @@ from cachetools.func import ttl_cache
|
|||
from registrar.utility.s3_bucket import S3ClientError, S3ClientHelper
|
||||
|
||||
|
||||
DOMAIN_FILE_URL = "https://raw.githubusercontent.com/cisagov/dotgov-data/main/current-full.csv"
|
||||
RDAP_URL = "https://rdap.cloudflareregistry.com/rdap/domain/{domain}"
|
||||
|
||||
|
||||
|
@ -42,30 +41,6 @@ DOMAIN_API_MESSAGES = {
|
|||
}
|
||||
|
||||
|
||||
# this file doesn't change that often, nor is it that big, so cache the result
|
||||
# in memory for ten minutes
|
||||
@ttl_cache(ttl=600)
|
||||
def _domains():
|
||||
"""Return a list of the current .gov domains.
|
||||
|
||||
Fetch a file from DOMAIN_FILE_URL, parse the CSV for the domain,
|
||||
lowercase everything and return the list.
|
||||
"""
|
||||
DraftDomain = apps.get_model("registrar.DraftDomain")
|
||||
# 5 second timeout
|
||||
file_contents = requests.get(DOMAIN_FILE_URL, timeout=5).text
|
||||
domains = set()
|
||||
# skip the first line
|
||||
for line in file_contents.splitlines()[1:]:
|
||||
# get the domain before the first comma
|
||||
domain = line.split(",", 1)[0]
|
||||
# sanity-check the string we got from the file here
|
||||
if DraftDomain.string_could_be_domain(domain):
|
||||
# lowercase everything when we put it in domains
|
||||
domains.add(domain.lower())
|
||||
return domains
|
||||
|
||||
|
||||
def check_domain_available(domain):
|
||||
"""Return true if the given domain is available.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue