Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Bugfix in check_dns_exists #178

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions app/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,16 @@ def check_dns_exists():
try:
response = requests.get(url)
if response.status_code == HTTPStatus.OK and response.content:
json_response = response.json()
if "domain" in json_response:
cached_domain = json_response["domain"]
return cached_domain
if response.headers["Content-Type"] == "application/json":
json_response = response.json()
if json_response is not None and "domain" in json_response:
cached_domain = json_response["domain"]
return cached_domain
else:
logger.error("Domain field not found in response.")
return None
else:
logger.error("Domain field not found in response.")
logger.error("Response is not a valid JSON.")
return None
else:
logger.error(
Expand Down