Skip to content

Commit 2ce0cd7

Browse files
committed
SSL Validation with Certifi
1 parent a4ad829 commit 2ce0cd7

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/utils/updater.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
11
from typing import Self, Any
22

33
from shutil import copytree, rmtree, move
4+
45
from os import mkdir, rename, remove, chmod
56
from os.path import exists
6-
from subprocess import run
77

8+
from subprocess import run
89
from datetime import datetime
910
from plistlib import dumps
10-
11-
from urllib.request import urlopen, urlretrieve
1211
from zipfile import ZipFile
1312

1413
from utils.appdata import AppData, read, write
1514

15+
from certifi import where as certifi_where
16+
from ssl import create_default_context
17+
18+
from urllib.request import (
19+
urlopen,
20+
urlretrieve,
21+
build_opener,
22+
install_opener,
23+
HTTPSHandler
24+
)
25+
26+
context = create_default_context(cafile=certifi_where())
27+
opener = build_opener(HTTPSHandler(context=context))
28+
install_opener(opener)
29+
1630
def fetch_url(url: str) -> str | None:
1731
with urlopen(url) as response:
1832
if response.status != 200:

0 commit comments

Comments
 (0)