Skip to content

Commit

Permalink
Check for errors from requests.get (#2883)
Browse files Browse the repository at this point in the history
  • Loading branch information
sciencewhiz authored Dec 23, 2024
1 parent c09391e commit c0895b4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions source/_extensions/wpilib_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def run(self) -> List[nodes.Node]:

release_url = f"https://api.github.com/repos/wpilibsuite/allwpilib/releases/tags/{version}"
release_json = requests.get(release_url)
release_json.raise_for_status()
release: Dict = release_json.json()

cf_folder = f"https://packages.wpilib.workers.dev/installer/{version}"
Expand All @@ -32,9 +33,9 @@ def run(self) -> List[nodes.Node]:
)

def get_url_size(osname):
soup = BeautifulSoup(
requests.get(f"{cf_folder}/{osname}/").text, "html.parser"
)
release_data = requests.get(f"{cf_folder}/{osname}/")
release_data.raise_for_status()
soup = BeautifulSoup(release_data.text, "html.parser")
file = str(soup.find_all("tr")[-1].contents[0].string)
size = str(soup.find_all("tr")[-1].contents[2].string)
url_part = f"/{osname}/{file}"
Expand Down

0 comments on commit c0895b4

Please sign in to comment.