fix: SSL: CERTIFICATE_VERIFY_FAILED when running compiled version

This commit is contained in:
sebthom
2024-08-05 13:47:01 +02:00
parent a74c618b36
commit 0491636666
3 changed files with 18 additions and 3 deletions

12
pdm.lock generated
View File

@@ -5,7 +5,7 @@
groups = ["default", "dev"]
strategy = []
lock_version = "4.5.0"
content_hash = "sha256:0966c51271fe3e6554e908f21ae1f4b128d87ec265f472420a0621b651bc75ca"
content_hash = "sha256:bdc0ef3162d651a6a122298719e21630b9d8d63d571f8269a0189f72fdf622a5"
[[metadata.targets]]
requires_python = ">=3.10,<3.13"
@@ -72,6 +72,16 @@ files = [
{file = "bracex-2.5.tar.gz", hash = "sha256:0725da5045e8d37ea9592ab3614d8b561e22c3c5fde3964699be672e072ab611"},
]
[[package]]
name = "certifi"
version = "2024.7.4"
requires_python = ">=3.6"
summary = "Python package for providing Mozilla's CA Bundle."
files = [
{file = "certifi-2024.7.4-py3-none-any.whl", hash = "sha256:c198e21b1289c2ab85ee4e67bb4b4ef3ead0892059901a8d5b622f24a1101e90"},
{file = "certifi-2024.7.4.tar.gz", hash = "sha256:5a1e7645bc0ec61a09e26c36f6106dd4cf40c6db3a1fb6352b0244e7fb057c7b"},
]
[[package]]
name = "colorama"
version = "0.4.6"

View File

@@ -40,6 +40,7 @@ dependencies = [
"psutil",
"pywin32; sys_platform == 'win32'",
"wcmatch",
"certifi>=2024.7.4",
]
[project.urls]

View File

@@ -11,7 +11,7 @@ from datetime import datetime
from logging.handlers import RotatingFileHandler
from typing import Any, Final
import colorama, nodriver
import certifi, colorama, nodriver
from overrides import overrides
from ruamel.yaml import YAML
from wcmatch import glob
@@ -34,6 +34,10 @@ class KleinanzeigenBot(WebScrapingMixin):
def __init__(self) -> None:
# workaround for https://github.com/Second-Hand-Friends/kleinanzeigen-bot/issues/295
# see https://github.com/pyinstaller/pyinstaller/issues/7229#issuecomment-1309383026
os.environ["SSL_CERT_FILE"] = certifi.where()
super().__init__()
self.root_url = "https://www.kleinanzeigen.de"
@@ -615,7 +619,7 @@ class KleinanzeigenBot(WebScrapingMixin):
# wait for captcha
#############################
try:
await self.web_find(By.CSS_SELECTOR,"iframe[name^='a-'][src^='https://www.google.com/recaptcha/api2/anchor?']", timeout=2)
await self.web_find(By.CSS_SELECTOR, "iframe[name^='a-'][src^='https://www.google.com/recaptcha/api2/anchor?']", timeout = 2)
LOG.warning("############################################")
LOG.warning("# Captcha present! Please solve the captcha.")
LOG.warning("############################################")