import requests
BASE_URL = "https://core.hyperx.dev"
PROJECT_CODE = "your-project-code"
# 1) Generate pre-signed download URL
url_resp = requests.get(
f"{BASE_URL}/v1/storage/download-url",
params={
"filename": "images/logo.png",
# "tag": "v2",
},
headers={"x-project-code": PROJECT_CODE},
timeout=10,
)
url_resp.raise_for_status()
download_url = url_resp.json()["url"]
print("download_url:", download_url)
# 2) Download actual file
file_resp = requests.get(download_url, timeout=30)
file_resp.raise_for_status()
with open("logo.png", "wb") as f:
f.write(file_resp.content)
print("saved:", "logo.png", "bytes=", len(file_resp.content))