From 779740b6c1c2620f8914590d4379433d6d6468b0 Mon Sep 17 00:00:00 2001 From: "Greg P." <88697977+zvxvx@users.noreply.github.com> Date: Fri, 17 Jan 2025 12:44:22 -0800 Subject: [PATCH] Change timeout from 10 to 30 I had an issue with the script timing out whenever I tried to set the cron job for the script to run at any other time than every minute. Changing this from 10 to 30 fixed the problem. --- porkbun_ddns/porkbun_ddns.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/porkbun_ddns/porkbun_ddns.py b/porkbun_ddns/porkbun_ddns.py index 874e477..3f47e0b 100644 --- a/porkbun_ddns/porkbun_ddns.py +++ b/porkbun_ddns/porkbun_ddns.py @@ -66,7 +66,7 @@ def get_public_ips(self) -> list: "https://ipv4.icanhazip.com"] for url in urls: try: - with urllib.request.urlopen(url, timeout=10) as response: + with urllib.request.urlopen(url, timeout=30) as response: if response.getcode() == 200: public_ips.append( response.read().decode("utf-8").strip()) @@ -82,7 +82,7 @@ def get_public_ips(self) -> list: "https://ipv6.icanhazip.com"] for url in urls: try: - with urllib.request.urlopen(url, timeout=10) as response: + with urllib.request.urlopen(url, timeout=30) as response: if response.getcode() == 200: public_ips.append( response.read().decode("utf-8").strip()) @@ -107,7 +107,7 @@ def _api(self, target: str, data: dict | None = None) -> dict: req = urllib.request.Request(self.config["endpoint"] + target) req.data = json.dumps(data).encode("utf8") try: - response = urllib.request.urlopen(req, timeout=10).read() + response = urllib.request.urlopen(req, timeout=30).read() except HTTPError as err: if err.code == 400: raise PorkbunDDNS_Error("Invalid API Keys!")