From a692ba29e98b72fbad781338c3f62936e5721d7d Mon Sep 17 00:00:00 2001
From: kazix <tmakzmierczak@man.poznan.pl>
Date: Tue, 2 Aug 2022 12:36:59 +0200
Subject: [PATCH] clean main.py before last commit

---
 main.py | 41 ++++++++++-------------------------------
 1 file changed, 10 insertions(+), 31 deletions(-)

diff --git a/main.py b/main.py
index 531a010..5d50575 100644
--- a/main.py
+++ b/main.py
@@ -18,7 +18,7 @@ load_dotenv()
 try:
     if args.production:
         token = os.getenv('PRODUCTION_TOKEN')
-        print('produkcyjny')
+        print('Production Mode, connect to server')
         headers = {'PRIVATE-TOKEN': token}
         gl = gitlab.Gitlab(url='https://gitlab.geant.org', private_token=token)
         gl_user = 'https://gitlab.geant.org/api/v4/users'
@@ -28,7 +28,7 @@ try:
         projects = gl.projects.list(all=True)
     elif args.developer:
         token = os.getenv('DEVELOPER_TOKEN')
-        print('testowy')
+        print('Production Mode, connect to server')
         headers = {'PRIVATE-TOKEN': token}
         gl = gitlab.Gitlab(url='https://k8s-gitlab.software.geant.org', private_token=token)
         gl_user = 'https://k8s-gitlab.software.geant.org/api/v4/users'
@@ -37,38 +37,16 @@ try:
         gl_branch = 'repository/branches'
         projects = gl.projects.list(all=True)
     else:
-        print("No variable, exit")
+        print("--production or --developer, please, now exit")
         exit()
 
-    # pobieranie listy projektów
-
-    # # testowe
-    # headers = {'PRIVATE-TOKEN': 'glpat-hQFB1vBzz9rQzq8wuhcG'}
-    # gl = gitlab.Gitlab(url='https://k8s-gitlab.software.geant.org', private_token='glpat-hQFB1vBzz9rQzq8wuhcG')
-    # gl_user = 'https://k8s-gitlab.software.geant.org/api/v4/users'
-    # gl_proj = 'https://k8s-gitlab.software.geant.org/api/v4/projects'
-    # gl_license = 'repository/files/LICENSE?ref='
-    # gl_branch = 'repository/branches'
-    # projects = gl.projects.list()
-    # # (all=True)
-
-
-    # produkcyjne
-    # headers = {'PRIVATE-TOKEN': 'glpat-P6orz6-t2f3n1BoVDrnr'}
-    # gl = gitlab.Gitlab(url='https://gitlab.geant.org', private_token='glpat-P6orz6-t2f3n1BoVDrnr')
-    # gl_user = 'https://gitlab.geant.org/api/v4/users'
-    # gl_proj = 'https://gitlab.geant.org/api/v4/projects'
-    # gl_license = 'repository/files/LICENSE?ref='
-    # gl_branch = 'repository/branches'
-    # projects = gl.projects.list(all=True)
-
     j_project = {}
     j_project['projects'] = {}
     for project in projects:
         # print('Project ID: ', project.attributes['id'])
-        # print('Project Name: ', project.attributes['name_with_namespace'])
+        print('Project Name: ', project.attributes['name_with_namespace'])
         # # print('branch', project.attributes['default_branch'])
-        # print('status', project.attributes['visibility'])
+        print('Status:', project.attributes['visibility'])
         # print('aktywny', project.attributes['last_activity_at'])
         # print('grupa', project.attributes['namespace']['name'])
         x = project.attributes['id']
@@ -84,10 +62,10 @@ try:
             c_data = c_response.text
             c_answer = json.loads(c_data)
             if "message" in c_answer:
-                # print("License file: ", c_answer['message'])
+                print("License file: ", c_answer['message'])
                 lic = c_answer['message']
             if "file_name" in c_answer:
-                # print("License file: ", c_answer['file_name'])
+                print("License file: ", c_answer['file_name'])
                 lic = c_answer['file_name']
             # print('branch', project.attributes['default_branch'])
         else:
@@ -95,7 +73,6 @@ try:
         sep = 'T'
         full_act = project.attributes['last_activity_at']
         last_act = full_act.split(sep, 1)[0]
-        # print("ostatnia aktywnosc: ", last_act)
         tmp = {
             'project_id': project.attributes['id'],
             'project_name': project.attributes['name_with_namespace'],
@@ -134,7 +111,7 @@ try:
                         'owner_mail_commit': user.commit_email
                     }
                 j_project['projects'][x]['owners'][y] = user_tmp
-        # print(8*"-")
+        print(8*"-")
 except:
     print('Cant connect to GitLab server, check credential')
     exit()
@@ -150,3 +127,5 @@ new_jproject_html = json2html.convert(json=new_jproject)
 
 with open("gitlab-projects.html", "w", encoding='utf8') as outfile:
     outfile.write(new_jproject_html)
+
+print("This is the end...")
-- 
GitLab