Author: sebb
Date: Sat Jan 24 15:40:00 2026
New Revision: 1931516

Log:
Simplify

Modified:
   comdev/reporter.apache.org/trunk/scripts/jira_auth.py
   comdev/reporter.apache.org/trunk/scripts/pdata.py

Modified: comdev/reporter.apache.org/trunk/scripts/jira_auth.py
==============================================================================
--- comdev/reporter.apache.org/trunk/scripts/jira_auth.py       Sat Jan 24 
15:33:40 2026        (r1931515)
+++ comdev/reporter.apache.org/trunk/scripts/jira_auth.py       Sat Jan 24 
15:40:00 2026        (r1931516)
@@ -6,6 +6,7 @@ INITIAL RELEASE: include more common cod
 """
 
 import os
+import base64
 
 JIRA_USER = os.environ.get('REPORTER_JIRA_USER', 'githubbot')
 jirapass = os.environ.get('REPORTER_JIRA_PASSWORD', '')
@@ -15,3 +16,6 @@ if jirapass == '':
 if jirapass == '':
       raise RuntimeError("Jira password cannot be empty")
 JIRA_PASS = jirapass
+
+def basic_auth():
+      return base64.encodebytes(('%s:%s' % (JIRA_USER, 
JIRA_PASS)).encode('ascii')).decode('ascii')[:-1]

Modified: comdev/reporter.apache.org/trunk/scripts/pdata.py
==============================================================================
--- comdev/reporter.apache.org/trunk/scripts/pdata.py   Sat Jan 24 15:33:40 
2026        (r1931515)
+++ comdev/reporter.apache.org/trunk/scripts/pdata.py   Sat Jan 24 15:40:00 
2026        (r1931516)
@@ -22,7 +22,7 @@
 """
 
 import os, sys, re, json, time
-import base64, requests
+import requests
 
 CACHE_TIMEOUT = 7200
 
@@ -123,11 +123,7 @@ def getJIRAProjects(project, tlpid):
         if mtime >= (time.time() - 86400):
             x = readJson(RAOHOME+"data/JIRA/jira_projects.json")
         else:
-            if sys.version_info >= (3, 0):
-                base64string = base64.encodebytes(('%s:%s' % 
(jira_auth.JIRA_USER, 
jira_auth.JIRA_PASS)).encode('ascii')).decode('ascii')[:-1]
-            else:
-                base64string = base64.encodebytes('%s:%s' % 
(jira_auth.JIRA_USER, jira_auth.JIRA_PASS))[:-1]
-    
+            base64string = jira_auth.basic_auth()    
             try:
                 x = 
requests.get("https://issues.apache.org/jira/rest/api/2/project.json";, headers 
= {"Authorization": "Basic %s" % base64string}).json()
                 with open(RAOHOME+"data/JIRA/jira_projects.json", "w") as f:
@@ -172,10 +168,7 @@ def getJIRAS(project):
     except:
         pass
     if refresh:
-        if sys.version_info >= (3, 0):
-            base64string = base64.encodebytes(('%s:%s' % (jira_auth.JIRA_USER, 
jira_auth.JIRA_PASS)).encode('ascii')).decode('ascii')[:-1]
-        else:
-            base64string = base64.encodebytes('%s:%s' % (jira_auth.JIRA_USER, 
jira_auth.JIRA_PASS))[:-1]
+        base64string = jira_auth.basic_auth()    
         try:
             headers = {"Authorization": "Basic %s" % base64string}
             req = 
requests.get("""https://issues.apache.org/jira/rest/api/2/search?jql=project%20=%20'"""
 + project + """'%20AND%20created%20%3E=%20-91d""", headers = headers)

Reply via email to