Skip to content

Commit

Permalink
Merge pull request #1041 from ROCm/alexxu12/userAgent
Browse files Browse the repository at this point in the history
Fix: Add User-Agent into request header
  • Loading branch information
alexxu-amd authored Nov 27, 2024
2 parents db4d7b7 + 125d8d1 commit 08270b4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/rocm_docs/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@


def _get_version_from_url(url: str) -> str:
headers = {"User-Agent": "alexxu-amd"}
try:
retry_counter = 0
response = requests.get(url)
response = requests.get(url, headers=headers)

# Retry in case of failure
while (response.status_code != 200) and (retry_counter <= MAX_RETRY):
time.sleep(5)
response = requests.get(url)
response = requests.get(url, headers=headers)

if retry_counter > MAX_RETRY:
raise requests.RequestException(
Expand Down

0 comments on commit 08270b4

Please sign in to comment.