From e2aeec7c073314d958c75bf854bc9c4218f85c69 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Thu, 11 Dec 2025 21:59:14 +1100 Subject: [PATCH] handle differing output formats --- telegraf-last-docker-update.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/telegraf-last-docker-update.py b/telegraf-last-docker-update.py index 34456fe..1994079 100755 --- a/telegraf-last-docker-update.py +++ b/telegraf-last-docker-update.py @@ -144,10 +144,11 @@ def GetLastCommmitDaysAgo( container ): # Fetch the latest commit details from GitHub API response = requests.get(m[1]) response.raise_for_status() # Raise an error for bad status codes - if '0' in response.json(): - commit_info = response.json()[0] + tmp_resp = response.json() + if isinstance(tmp_resp, list): + commit_info = tmp_resp[0] else: - commit_info = response.json() + commit_info = tmp_resp # Extract the commit URL and date commit_url = commit_info["html_url"]