diff --git a/PyInstaller/hooks/hook-requests.py b/PyInstaller/hooks/hook-requests.py deleted file mode 100644 index 13de4b6b..00000000 --- a/PyInstaller/hooks/hook-requests.py +++ /dev/null @@ -1,4 +0,0 @@ -from PyInstaller.utils.hooks import collect_data_files - -# Get the cacert.pem -datas = collect_data_files("certifi") diff --git a/scripts/requirements-dev.txt b/scripts/requirements-dev.txt index c36b2e83..d36e4131 100644 --- a/scripts/requirements-dev.txt +++ b/scripts/requirements-dev.txt @@ -24,5 +24,4 @@ types-psutil types-PyAutoGUI types-pyinstaller types-pywin32>=306.0.0.8 ; sys_platform == 'win32' -types-requests types-toml diff --git a/scripts/requirements.txt b/scripts/requirements.txt index e01f9fcc..7973b50f 100644 --- a/scripts/requirements.txt +++ b/scripts/requirements.txt @@ -3,7 +3,6 @@ # Read /docs/build%20instructions.md for more information on how to install, run and build the python code. # # Dependencies: -certifi ImageHash>=4.3.1 ; python_version < '3.12' # Contains type information + setup as package not module # PyWavelets install broken on Python 3.12 git+https://github.com/boppreh/keyboard.git#egg=keyboard # Fix install on macos and linux-ci https://github.com/boppreh/keyboard/pull/568 numpy>=1.26 # Python 3.12 support @@ -15,13 +14,11 @@ PyAutoGUI PyWinCtl>=0.0.42 # py.typed # When needed, dev builds can be found at https://download.qt.io/snapshots/ci/pyside/dev?C=M;O=D PySide6-Essentials>=6.6.0 # Python 3.12 support -requests>=2.28.2 # charset_normalizer 3.x update toml typing-extensions>=4.4.0 # @override decorator support # # Build and compile resources pyinstaller>=5.13 # Python 3.12 support -pyinstaller-hooks-contrib>=2022.15 # charset-normalizer fix https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/534 # # https://peps.python.org/pep-0508/#environment-markers # diff --git a/src/AutoSplit.py b/src/AutoSplit.py index 3fd27f1b..383448fe 100644 --- a/src/AutoSplit.py +++ b/src/AutoSplit.py @@ -8,7 +8,6 @@ from types import FunctionType from typing import NoReturn -import certifi import cv2 from cv2.typing import MatLike from psutil import process_iter @@ -52,8 +51,6 @@ CHECK_FPS_ITERATIONS = 10 -# Needed when compiled, along with the custom hook-requests PyInstaller hook -os.environ["REQUESTS_CA_BUNDLE"] = certifi.where() myappid = f"Toufool.AutoSplit.v{AUTOSPLIT_VERSION}" shell32.SetCurrentProcessExplicitAppUserModelID(myappid) diff --git a/src/menu_bar.py b/src/menu_bar.py index f4107a27..172c1542 100644 --- a/src/menu_bar.py +++ b/src/menu_bar.py @@ -1,14 +1,15 @@ import asyncio +import json import webbrowser from typing import TYPE_CHECKING, Any, cast +from urllib.error import URLError +from urllib.request import urlopen -import requests from packaging.version import parse as version_parse from PySide6 import QtCore, QtWidgets from PySide6.QtCore import Qt from PySide6.QtGui import QBrush, QPalette from PySide6.QtWidgets import QFileDialog -from requests.exceptions import RequestException from typing_extensions import override import error_messages @@ -97,10 +98,11 @@ def __init__(self, autosplit: "AutoSplit", check_on_open: bool): @override def run(self): try: - response = requests.get(f"https://api.github.com/repos/{GITHUB_REPOSITORY}/releases/latest", timeout=30) - latest_version = str(response.json()["name"]).split("v")[1] + with urlopen(f"https://api.github.com/repos/{GITHUB_REPOSITORY}/releases/latest", timeout=30) as response: # noqa: S310 + json_response: dict[str, str] = json.loads(response.read()) + latest_version = json_response["name"].split("v")[1] self._autosplit_ref.update_checker_widget_signal.emit(latest_version, self.check_on_open) - except (RequestException, KeyError): + except (URLError, KeyError): if not self.check_on_open: self._autosplit_ref.show_error_signal.emit(error_messages.check_for_updates)