download vast.ai's root certificate in order to make pyworker requests

This commit is contained in:
Nader Arbabian
2025-07-31 12:47:12 -07:00
parent e0be45f39a
commit 9773e5f67b
5 changed files with 34 additions and 3 deletions
+15
View File
@@ -0,0 +1,15 @@
import tempfile
from functools import cache
import requests
@cache
def get_cert_file_path():
cert_url = "https://console.vast.ai/static/jvastai_root.cer"
response = requests.get(cert_url)
response.raise_for_status()
# Use a temporary file that is not deleted on close
with tempfile.NamedTemporaryFile(delete=False, suffix=".cer", mode="wb") as f:
f.write(response.content)
return f.name