mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 01:04:32 +02:00
allow unsafe ssl context for downloads
Signed-off-by: vladmandic <mandic00@live.com>
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user