diff --git a/manifests/media/qbittorrent.yaml b/manifests/media/qbittorrent.yaml index ffd078a..31e1fb1 100644 --- a/manifests/media/qbittorrent.yaml +++ b/manifests/media/qbittorrent.yaml @@ -95,14 +95,17 @@ spec: - python3 - -c - | - import http.server, urllib.request + import http.server, urllib.request, time class Handler(http.server.BaseHTTPRequestHandler): def do_GET(self): - try: - ip = urllib.request.urlopen('https://ipinfo.io/ip').read().decode().strip() - except Exception as e: - ip = f'error: {e}' + ip = 'connecting...' + for _ in range(5): + try: + ip = urllib.request.urlopen('https://ipinfo.io/ip', timeout=5).read().decode().strip() + break + except Exception: + time.sleep(2) body = f'''