mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-07 11:43:30 +02:00
Add updated RDAP API endpoint
This commit is contained in:
parent
2dca24f330
commit
3f7dbd5f6e
1 changed files with 4 additions and 4 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
from django.views.decorators.http import require_http_methods
|
from django.views.decorators.http import require_http_methods
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse, JsonResponse
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
|
|
||||||
from registrar.templatetags.url_helpers import public_site_url
|
from registrar.templatetags.url_helpers import public_site_url
|
||||||
|
@ -19,7 +19,7 @@ from registrar.utility.s3_bucket import S3ClientError, S3ClientHelper
|
||||||
|
|
||||||
|
|
||||||
DOMAIN_FILE_URL = "https://raw.githubusercontent.com/cisagov/dotgov-data/main/current-full.csv"
|
DOMAIN_FILE_URL = "https://raw.githubusercontent.com/cisagov/dotgov-data/main/current-full.csv"
|
||||||
RDAP_URL = "https://rdap.cloudflareregistry.com/rdap/domain/"
|
RDAP_URL = "https://rdap.cloudflareregistry.com/rdap/domain/{domain}"
|
||||||
|
|
||||||
|
|
||||||
DOMAIN_API_MESSAGES = {
|
DOMAIN_API_MESSAGES = {
|
||||||
|
@ -108,8 +108,8 @@ def rdap(request, domain=""):
|
||||||
Domain = apps.get_model("registrar.Domain")
|
Domain = apps.get_model("registrar.Domain")
|
||||||
domain = request.GET.get("domain", "")
|
domain = request.GET.get("domain", "")
|
||||||
|
|
||||||
rdap_response = requests.get(DOMAIN_FILE_URL, domain)
|
rdap_data = requests.get(RDAP_URL.format(domain=domain)).json()
|
||||||
return rdap_response
|
return JsonResponse(rdap_data)
|
||||||
|
|
||||||
|
|
||||||
@require_http_methods(["GET"])
|
@require_http_methods(["GET"])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue