bin/compare-crashreport-stats.py |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

New commits:
commit 1decbe7399c3abcd5ec36b874a76d33af9880ec3
Author:     Guilhem Moulin <guil...@libreoffice.org>
AuthorDate: Thu May 29 14:54:14 2025 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu May 29 15:38:00 2025 +0200

    Fix bin/compare-crashreport-stats.py
    
    Change-Id: I13cb6e4558307a4a913d9c0f7f04e2d48466d926
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186007
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Tested-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/bin/compare-crashreport-stats.py b/bin/compare-crashreport-stats.py
index 437b047eadcf..d5d7fa013a52 100755
--- a/bin/compare-crashreport-stats.py
+++ b/bin/compare-crashreport-stats.py
@@ -13,9 +13,10 @@ import requests
 from bs4 import BeautifulSoup
 import argparse
 
-def parse_url(url):
+def parse_url(version : str, session = requests):
     crashReports = {}
-    html_text = requests.get(url).text
+    url = "https://crashreport.libreoffice.org/stats/version/"; + version + 
"?limit=1000&days=30"
+    html_text = session.get(url).text
     soup = BeautifulSoup(html_text, 'html.parser')
 
     table = soup.find("table", {"id": "data-table"}).tbody
@@ -35,10 +36,10 @@ if __name__ == '__main__':
 
     results = parser.parse_args()
 
-    oldVersion = parse_url(
-            "https://crashreport.libreoffice.org/stats/version/"; + results.old 
+ "?limit=1000&days=30")
-    newVersion = parse_url(
-            "https://crashreport.libreoffice.org/stats/version/"; + results.new 
+ "?limit=1000&days=30")
+    session = requests.Session()
+    session.headers.update({'Referer': 'https://crashreport.libreoffice.org'})
+    oldVersion = parse_url(results.old, session=session)
+    newVersion = parse_url(results.new, session=session)
 
     print(str(len(oldVersion)) + " crash reports in version " + results.old)
     print(str(len(newVersion)) + " crash reports in version " + results.new)

Reply via email to