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

Commit

Permalink
bugfix (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
nsosio authored Nov 2, 2023
1 parent 812731a commit 347f3b1
Showing 1 changed file with 9 additions and 5 deletions.
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

0 comments on commit 347f3b1

Please sign in to comment.