allow unsafe ssl context for downloads

Signed-off-by: vladmandic <mandic00@live.com>
This commit is contained in:
vladmandic
2026-01-19 17:36:01 +01:00
parent ae357a5e49
commit 8cf27dffdb
7 changed files with 38 additions and 17 deletions
+4 -1
View File
@@ -274,13 +274,16 @@ def load_civitai(model: str, url: str):
def download_url_to_file(url: str, dst: str):
# based on torch.hub.download_url_to_file
import ssl
import uuid
import tempfile
from urllib.request import urlopen, Request
from rich.progress import Progress, TextColumn, BarColumn, TaskProgressColumn, TimeRemainingColumn, TimeElapsedColumn
file_size = None
req = Request(url, headers={"User-Agent": "sdnext"})
u = urlopen(req) # pylint: disable=R1732
context = ssl._create_unverified_context() # pylint: disable=protected-access
u = urlopen(req, context=context) # pylint: disable=R1732
meta = u.info()
if hasattr(meta, 'getheaders'):
content_length = meta.getheaders("Content-Length")