Merge pull request #54 from beatz174-bit/codex/fix-dynu-api-authentication-error
Handle Dynu API auth failures without Python traceback
This commit is contained in:
@@ -190,7 +190,11 @@ def main() -> int:
|
|||||||
|
|
||||||
base_url = os.environ.get("DYNU_BASE_URL", DEFAULT_BASE_URL).strip().strip("'").strip('"')
|
base_url = os.environ.get("DYNU_BASE_URL", DEFAULT_BASE_URL).strip().strip("'").strip('"')
|
||||||
|
|
||||||
|
try:
|
||||||
domains = list_domains(base_url, api_key)
|
domains = list_domains(base_url, api_key)
|
||||||
|
except RuntimeError as exc:
|
||||||
|
print(str(exc), file=sys.stderr)
|
||||||
|
return 1
|
||||||
target = [d for d in domains if str(d.get("name", "")).strip(".").lower() == BASE_DOMAIN]
|
target = [d for d in domains if str(d.get("name", "")).strip(".").lower() == BASE_DOMAIN]
|
||||||
|
|
||||||
if not target:
|
if not target:
|
||||||
@@ -207,7 +211,11 @@ def main() -> int:
|
|||||||
print(f"Domain entry for {BASE_DOMAIN} is missing 'id'; cannot fetch records.", file=sys.stderr)
|
print(f"Domain entry for {BASE_DOMAIN} is missing 'id'; cannot fetch records.", file=sys.stderr)
|
||||||
return 4
|
return 4
|
||||||
|
|
||||||
|
try:
|
||||||
records = list_records(base_url, api_key, domain_id)
|
records = list_records(base_url, api_key, domain_id)
|
||||||
|
except RuntimeError as exc:
|
||||||
|
print(str(exc), file=sys.stderr)
|
||||||
|
return 1
|
||||||
normalized_domains.append(
|
normalized_domains.append(
|
||||||
{
|
{
|
||||||
"name": str(d.get("name", BASE_DOMAIN)).strip().strip("."),
|
"name": str(d.get("name", BASE_DOMAIN)).strip().strip("."),
|
||||||
|
|||||||
Reference in New Issue
Block a user