]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
monitoring: add user-agent headers to the urllib
authorNizamudeen A <nia@redhat.com>
Wed, 10 Sep 2025 13:00:36 +0000 (18:30 +0530)
committerNizamudeen A <nia@redhat.com>
Wed, 10 Sep 2025 16:12:50 +0000 (21:42 +0530)
The documentation started raising 403 suddenly. Adding User-Agent
headers to the request

Signed-off-by: Nizamudeen A <nia@redhat.com>
(cherry picked from commit b8fe487010483681bbc8ddb8dfe18b40ebfd346b)

monitoring/ceph-mixin/tests_alerts/validate_rules.py

index c24ce5c59d55321b9f1452b6aa16f0e2b5560b09..8c1e329302498e94c3846c9bfe56f8ef684060a2 100755 (executable)
@@ -84,7 +84,14 @@ class HTMLCache:
         if url in self.cache:
             return self.cache[url]
 
-        req = urllib.request.Request(url)
+        headers = {
+            "User-Agent": (
+                "Mozilla/5.0 (X11; Linux x86_64) "
+                "AppleWebKit/537.36 (KHTML, like Gecko) "
+                "Chrome/139.0.0.0 Safari/537.36"
+            ),
+        }
+        req = urllib.request.Request(url, headers=headers)
         try:
             r = urllib.request.urlopen(req)
         except urllib.error.HTTPError as e: