From 28c6653b986e202148c961d8603a078c29aacd80 Mon Sep 17 00:00:00 2001 From: Nizamudeen A Date: Wed, 10 Sep 2025 18:30:36 +0530 Subject: [PATCH] monitoring: add user-agent headers to the urllib The documentation started raising 403 suddenly. Adding User-Agent headers to the request Signed-off-by: Nizamudeen A (cherry picked from commit b8fe487010483681bbc8ddb8dfe18b40ebfd346b) --- monitoring/ceph-mixin/tests_alerts/validate_rules.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/monitoring/ceph-mixin/tests_alerts/validate_rules.py b/monitoring/ceph-mixin/tests_alerts/validate_rules.py index c24ce5c59d5..8c1e3293024 100755 --- a/monitoring/ceph-mixin/tests_alerts/validate_rules.py +++ b/monitoring/ceph-mixin/tests_alerts/validate_rules.py @@ -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: -- 2.39.5