From 839da4b50d5d5057fbe134ac5794e30c3b53bc35 Mon Sep 17 00:00:00 2001 From: Dusan Cervenka Date: Fri, 8 Nov 2024 21:28:37 +0100 Subject: [PATCH] Added more descriptive error message Signed-off-by: Dusan Cervenka --- .gitignore | 3 +++ certbot_dns_wedos/dns_wedos.py | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..584b859 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +build +*.egg-info +dist diff --git a/certbot_dns_wedos/dns_wedos.py b/certbot_dns_wedos/dns_wedos.py index c81894f..bce0cc6 100644 --- a/certbot_dns_wedos/dns_wedos.py +++ b/certbot_dns_wedos/dns_wedos.py @@ -1,10 +1,10 @@ import hashlib, pytz, re -from datetime import datetime +from datetime import datetime import requests, json from typing import Any, Callable, Optional -import logging +import logging from certbot import errors from certbot.plugins.dns_common import CredentialsConfiguration, DNSAuthenticator @@ -58,6 +58,7 @@ def _handlerResponse(self, response: requests.post) -> dict: if response['response']['code'] >= 2000: raise errors.PluginError('Error code received from Wedos API, The error ' f'code is {response["response"]["code"]}, ' + f'details {response["response"]}' f'you can find what the code mean here: {WEDOS_CODE}') return response @@ -133,7 +134,7 @@ def _validate_credentials(self, credentials: CredentialsConfiguration) -> None: if not auth: raise errors.PluginError('Missing parameter AUTH (password) for the Wedos API.' ' [dns_wedos_auth=ExamplePassword]') - if propagation_seconds < 300: + if propagation_seconds < 300: raise errors.PluginError('Propagation seconds cannot be lower than 300 seconds.' ' (Recommended propagation time is 420 seconds)') if '@' not in user: