From 07f7ba186c7c55d4b14d43e69d834a32b3256bf5 Mon Sep 17 00:00:00 2001
From: "Sigmund, Dominik" <dominik.sigmund@br.de>
Date: Mon, 31 Jul 2023 10:43:01 +0000
Subject: [PATCH] Update file script.py

---
 script.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/script.py b/script.py
index b213155..d72ce15 100644
--- a/script.py
+++ b/script.py
@@ -78,8 +78,16 @@ def get_total_commits_last_month(gl):
     total_commits_last_month = 0
     projects = gl.projects.list(all=True)
     for project in projects:
-        commits = project.commits.list(since=last_month_start, until=last_month_end)
-        total_commits_last_month += len(commits)
+        try:
+            commits = project.commits.list(since=last_month_start, until=last_month_end)
+            total_commits_last_month += len(commits)
+        except gitlab.exceptions.GitlabHttpError as e:
+            if e.response_code == 404:
+                # Repository not found for the project
+                print(f"Warning: Repository not found for project '{project.name}'")
+            else:
+                # Other GitLab API error
+                print(f"Error: GitLab API error for project '{project.name}': {e}")
 
     return total_commits_last_month
 
@@ -113,7 +121,7 @@ def get_gitlab_info(api_token):
     print("Auth successful")
 
     # Get the number of projects
-    projects = gl.projects.list()
+    projects = gl.projects.list(all=True)
     num_projects = len(projects)
     print(f"Number of projects: {num_projects}")
 
-- 
GitLab