[Libreoffice-commits] dev-tools.git: esc-reporting/esc-collect.py

jan Iversen jani at libreoffice.org
Tue May 16 17:50:37 UTC 2017


 esc-reporting/esc-collect.py |   27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

New commits:
commit 6b31dcdd5048cb549144a5a697d966ef909e7d10
Author: jan Iversen <jani at libreoffice.org>
Date:   Tue May 16 19:50:13 2017 +0200

    esc-report, remove auth from patch collection

diff --git a/esc-reporting/esc-collect.py b/esc-reporting/esc-collect.py
index 685e673..6931773 100755
--- a/esc-reporting/esc-collect.py
+++ b/esc-reporting/esc-collect.py
@@ -54,23 +54,26 @@ def util_load_file(fileName):
 
 
 
-def util_load_url(url, useDict=False, useRaw=False, uUser=None, uPass=None):
+def util_load_url(url, useDict=False, useRaw=False, useSkipJSON=False, uUser=None, uPass=None):
     try:
       if uUser is None:
         r = requests.get(url)
-        if useDict:
-          try:
-            rawData = xmltodict.parse(x)
-          except Exception as e:
-            rawData = {'response': {'result': {'project': {},
-                                    'contributor_fact': {}}}}
-        elif useRaw:
-          rawData = r.text
-        else:
-          rawData = r.json()
       else:
         r = requests.get(url, auth=HTTPDigestAuth(uUser, uPass))
+        useSkipJSON = True
+
+      if useDict:
+        try:
+          rawData = xmltodict.parse(x)
+        except Exception as e:
+          rawData = {'response': {'result': {'project': {},
+                                    'contributor_fact': {}}}}
+      elif useRaw:
+        rawData = r.text
+      elif useSkipJSON:
         rawData = json.loads(r.text[5:])
+      else:
+        rawData = r.json()
       r.close()
     except Exception as e:
       print('Error load url ' + url + ' due to ' + str(e))
@@ -576,7 +579,7 @@ def get_gerrit(cfg):
     if 'offset' in rawList:
       offset = int(rawList['offset'])
     while True:
-      tmp = util_load_url(url + str(offset), uUser=uid, uPass=upw)
+      tmp = util_load_url(url + str(offset), useSkipJSON=True)
       for row in tmp:
         for i in 'email', 'username', 'name':
           if not i in row['owner']:


More information about the Libreoffice-commits mailing list