Skip to content

Commit 6e4c98f

Browse files
committed
fix(network): ensure SSL works in PyInstaller build using certifi bundle
1 parent d97e892 commit 6e4c98f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

async_rutube_downloader/utils/create_session.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import ssl
12
from asyncio import AbstractEventLoop
23

3-
from aiohttp import ClientSession, ClientTimeout
4+
import certifi
5+
from aiohttp import ClientSession, ClientTimeout, TCPConnector
46

57
from async_rutube_downloader.utils.miscellaneous import get_or_create_loop
68

@@ -24,8 +26,15 @@ def create_aiohttp_session(
2426
# Chunks are small in size,
2527
# so 3 minutes should be enough to download one chunk.
2628
)
29+
30+
# Fixes [SSL: CERTIFICATE_VERIFY_FAILED] in PyInstaller builds,
31+
# especially on GitHub Actions, where system CA certs may be missing.
32+
# certifi provides a portable CA bundle for reliable HTTPS.
33+
ssl_context = ssl.create_default_context(cafile=certifi.where())
34+
connector = TCPConnector(ssl=ssl_context, loop=loop)
2735
return ClientSession(
2836
loop=loop,
2937
timeout=session_timeout,
38+
connector=connector,
3039
raise_for_status=True,
3140
)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "async_rutube_downloader"
3-
version = "1.4.1"
3+
version = "1.4.2"
44
description = "download video from RuTube"
55
authors = [{ name = "Miron Sadykov", email = "MironSadykov@yandex.ru" }]
66
readme = "docs/README.md"

0 commit comments

Comments
 (0)