feat: ajouts get testing et corrections
This commit is contained in:
@@ -106,3 +106,50 @@ def get_debian_iso_urls():
|
||||
"name": signature_file_name,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def get_debian_testing_iso_urls():
|
||||
"""Retrieves a dict containing the URLs for a debian testing installation image.
|
||||
|
||||
Similar to get_debian_iso_urls() but for the testing release.
|
||||
"""
|
||||
|
||||
# request the debian testing releases page
|
||||
releases_url = "https://cdimage.debian.org/cdimage/weekly-builds/amd64/iso-cd/"
|
||||
releases_page = requests.get(releases_url)
|
||||
if not releases_page.status_code == 200:
|
||||
raise RuntimeError("Unexpected status code during request.")
|
||||
|
||||
hash_file_name = "SHA512SUMS"
|
||||
hash_file_url = releases_url + hash_file_name
|
||||
signature_file_name = "SHA512SUMS.sign"
|
||||
signature_file_url = releases_url + signature_file_name
|
||||
|
||||
# find the exact URL to the latest testing x64 netinst ISO file
|
||||
soup = BeautifulSoup(releases_page.content, "html.parser")
|
||||
image_file_links = soup.find_all(
|
||||
name="a",
|
||||
string=compile(r"debian-testing-amd64-netinst.iso")
|
||||
)
|
||||
if len(image_file_links) != 1:
|
||||
raise RuntimeError(
|
||||
"Failed to find an exact match while looking for "
|
||||
"a link to the latest debian testing image file."
|
||||
)
|
||||
image_file_name = image_file_links[0]['href']
|
||||
image_file_url = releases_url + image_file_name
|
||||
|
||||
return {
|
||||
"image_file": {
|
||||
"url": image_file_url,
|
||||
"name": image_file_name,
|
||||
},
|
||||
"hash_file": {
|
||||
"url": hash_file_url,
|
||||
"name": hash_file_name,
|
||||
},
|
||||
"signature_file": {
|
||||
"url": signature_file_url,
|
||||
"name": signature_file_name,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user