From 8a4e674d3b74dcd08f5e22d62b500d50f80cbf66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20H=C3=B6ffken?= Date: Thu, 20 Jun 2024 17:48:16 +0200 Subject: [PATCH] We need to use as --- certbot_dns_hetzner/dns_hetzner.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/certbot_dns_hetzner/dns_hetzner.py b/certbot_dns_hetzner/dns_hetzner.py index 0383358..2a9abea 100644 --- a/certbot_dns_hetzner/dns_hetzner.py +++ b/certbot_dns_hetzner/dns_hetzner.py @@ -48,10 +48,12 @@ def _get_zone(domain): return '.'.join([zone_name.domain, zone_name.suffix]) def _perform(self, domain, validation_name, validation): - self._get_hetzner_client(domain).create_record("TXT", self._fqdn_format(validation_name), validation) + with self._get_hetzner_client(domain) as client: + client.create_record("TXT", self._fqdn_format(validation_name), validation) def _cleanup(self, domain, validation_name, validation): - self._get_hetzner_client(domain).delete_record(None, "TXT", self._fqdn_format(validation_name), validation) + with self._get_hetzner_client(domain) as client: + client.delete_record(None, "TXT", self._fqdn_format(validation_name), validation) def _get_hetzner_client(self, domain): config = ConfigResolver().with_env().with_dict({