Merge pull request #7 from kbenestad/mdcms_cli

Fix SSL cert verification in PyInstaller binaries via certifi
This commit is contained in:
Kristian Benestad 2026-05-09 00:06:47 +07:00 committed by GitHub
commit 74140e0f5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 2 deletions

View file

@ -42,7 +42,7 @@ jobs:
python-version: "3.12"
- name: Install dependencies
run: pip install pyinstaller click pyyaml
run: pip install pyinstaller click pyyaml certifi
- name: Build binary
run: pyinstaller --onefile --name mdcms mdcms.py

View file

@ -10,10 +10,13 @@
import json
import os
import re
import ssl
import urllib.error
import urllib.request
from pathlib import Path
import certifi
import click
import yaml
@ -434,7 +437,8 @@ def _github_get(url: str) -> bytes:
"Accept": "application/vnd.github.v3+json",
},
)
with urllib.request.urlopen(req, timeout=15) as resp:
ctx = ssl.create_default_context(cafile=certifi.where())
with urllib.request.urlopen(req, timeout=15, context=ctx) as resp:
return resp.read()

View file

@ -13,6 +13,7 @@ requires-python = ">=3.9"
dependencies = [
"click>=8.0",
"PyYAML>=6.0",
"certifi>=2024.0",
]
[project.scripts]