Skip to content

Commit 32791b2

Browse files
author
Ofir Gordon
committed
test links checker
1 parent d5a15a3 commit 32791b2

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

tests/doc_tests/test_docs_links.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,13 @@ class TestDocsLinks(unittest.TestCase):
3030

3131
@staticmethod
3232
def check_link(_url, branch_name):
33+
headers = {'User-Agent': 'Mozilla/5.0'}
3334
try:
34-
retry_attempts = 5
35-
for attempt in range(retry_attempts):
36-
response = requests.get(_url)
37-
print(f"[{response.status_code}] {_url}")
38-
if response.status_code == 429:
39-
wait_time = 0.1 # Exponential backoff
40-
print(f"Rate-limited! Retrying in {wait_time} seconds...")
41-
time.sleep(wait_time)
42-
else:
43-
break
35+
response = requests.get(_url, headers=headers, timeout=1)
36+
print(f"[{response.status_code}] {_url}")
4437

45-
if response.status_code == 200:
46-
return True
38+
if response.status_code == 200:
39+
return True
4740
except Exception as e:
4841
print(f"Error checking link '{_url}': {e}")
4942

0 commit comments

Comments
 (0)