Skip to content

Commit

Permalink
Godaddy apex fix (#195)
Browse files Browse the repository at this point in the history
* godaddy-apex-fix

* chore: update the docs

* chore: black
  • Loading branch information
SimonGurney authored Sep 27, 2024
1 parent 3feaef9 commit 1c1c168
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions docs/godaddy.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
10 changes: 7 additions & 3 deletions providers/godaddy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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


Expand Down

0 comments on commit 1c1c168

Please sign in to comment.