made code a bit more readable

This commit is contained in:
2025-08-23 02:49:58 +02:00
parent e76e251b26
commit 5c58d5c6ac
2 changed files with 2 additions and 2 deletions
+2 -1
View File
@@ -54,14 +54,15 @@ if found == True:
file = requests.get(f"https://www.api.curseforge.com/v1/mods/{selected_modpack_id}/files/{server_file_id}", headers=headers)
download_url = file.json()['data']['downloadUrl']
print(f"Download Url: {download_url}")
dl_response = requests.get(download_url, stream=True)
with open(f"{selected_modpack_name}-server.zip", 'wb') as f:
for chunk in dl_response.iter_content(chunk_size=8192):
f.write(chunk)
with zipfile.ZipFile(f"{selected_modpack_name}-server.zip", 'r') as zip_ref:
zip_ref.extractall(f"{selected_modpack_name}-server")
os.remove(f"{selected_modpack_name}-server.zip")
break
else:
print("No server pack found for this modpack.")