From 1c1c168ee6be0e9e7ff4f030aa9b91cf45e79f9b Mon Sep 17 00:00:00 2001 From: SimonGurney Date: Fri, 27 Sep 2024 23:04:27 +0100 Subject: [PATCH] Godaddy apex fix (#195) * godaddy-apex-fix * chore: update the docs * chore: black --- docs/godaddy.md | 2 ++ providers/godaddy.py | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/godaddy.md b/docs/godaddy.md index d727566..75d004c 100644 --- a/docs/godaddy.md +++ b/docs/godaddy.md @@ -1,5 +1,7 @@ # GoDaddy +## WARNING: GoDaddy now block API access unless you have 10 domains and email their support. Craaaazy! + ## Description The GoDaddy provider connects to the GoDaddy API and retrieves domains and records. diff --git a/providers/godaddy.py b/providers/godaddy.py index c49083e..06a1341 100644 --- a/providers/godaddy.py +++ b/providers/godaddy.py @@ -25,7 +25,10 @@ def __init__(self, api_key, api_secret): def check_response(response: requests.Response): if response.status_code == 401: raise ValueError("Invalid API key specified.") - + if response.status_code == 403: + raise ValueError( + "API key valid but access denied. GoDaddy now block API access unless you have at least 10 domains" + ) if response.status_code < 200 or response.status_code >= 300: raise ValueError( "Invalid response received from API: " + str(response.json()) @@ -81,10 +84,11 @@ def extract_records(desired_type): if "AAAA" in buf[subdomain].keys(): domain.AAAA = extract_records("AAAA") if "CNAME" in buf[subdomain].keys(): - domain.CNAME = extract_records("CNAME") + domain.CNAME = [ + x.replace("@", root_domain) for x in extract_records("CNAME") + ] if "NS" in buf[subdomain].keys(): domain.NS = extract_records("NS") - yield domain