Skip to content

Commit

Permalink
fix download url, closes #6
Browse files Browse the repository at this point in the history
  • Loading branch information
not-a-feature committed May 27, 2024
1 parent adb6080 commit ccee7f8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/wd_fw_update/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ def get_upgrade_url(
"""

model = model.replace(" ", "_")
prop_url = f"{BASE_WD_DOMAIN}/firmware/{model}/{version}/device_properties.xml"
base_url = f"{BASE_WD_DOMAIN}/firmware/{model}/{version}"
prop_url = f"{base_url}/device_properties.xml"

_logger.debug(f"Firmware properties url: {prop_url}")

Expand All @@ -337,7 +338,7 @@ def get_upgrade_url(
print(f"upgrade to one of these versions first: {dependencies_list}")
exit(1)

firmware_url = f"{prop_url}{root.findtext('fwfile')}"
firmware_url = f"{base_url}/{root.findtext('fwfile')}"

_logger.debug(f"Firmware file url: {firmware_url}\n")
return firmware_url
Expand Down Expand Up @@ -388,6 +389,11 @@ def update_fw(
pbar.update(len(data))
fw_file.write(data)

_logger.info(f"HTTP Status Code: {r.status_code}")
if not r.status_code == 200:
print("Error downloading the firmware file.")
exit(1)

print()
print("========== Summary ==========")
print(f"NVME location: {device}")
Expand Down

0 comments on commit ccee7f8

Please sign in to comment.