Second-Hand-Friends / kleinanzeigen-bot

A dilligent command line tool to publish ads on kleinanzeigen.de
GNU Affero General Public License v3.0
197 stars 43 forks source link

[BUG] SSL: CERTIFICATE_VERIFY_FAILED #295

Open jhoogeboom opened 4 months ago

jhoogeboom commented 4 months ago

βœ”οΈ Expected Behaviour

When running the latest version (https://github.com/Second-Hand-Friends/kleinanzeigen-bot/releases/download/latest/kleinanzeigen-bot-darwin-amd64) on macos, doing a ./kleinanzeigen-bot download I expect to download the images without error.

🐞 Actual Behaviour

[INFO] Loaded 4 ads [INFO] Start fetch task for your unsaved ads! [INFO] New directory for ad created at downloaded-ads/ad_2739271815. [INFO] Extracting information from ad with title "Vollholz Kleiderschrank" [INFO] Found 2 images. [ERROR] URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)> [85601] Failed to execute script 'main' due to unhandled exception! successfully removed temp profile /var/folders/gg/bctglzxn0k9fs9zrn0qbvtbc0000gn/T/uc_ixn2urxs

πŸ“‹ Steps to Reproduce

On macOS:

curl -L https://github.com/Second-Hand-Friends/kleinanzeigen-bot/releases/download/latest/kleinanzeigen-bot-darwin-amd64 -o kleinanzeigen-bot
chmod 755 kleinanzeigen-bot
./kleinanzeigen-bot download

πŸ“Ί What browsers are you seeing the problem on? (if applicable)

No response

πŸ’» What operating systems are you seeing the problem on? (if applicable)

No response

πŸ“ƒ Relevant log output (if applicable)

No response

Code of Conduct

jhoogeboom commented 4 months ago

This only occurs when I use the binary, when using the source, it works fine.

Nuc1eoN commented 3 months ago

Yup, same! On Linux. From source it works.

sebthom commented 1 month ago

This is probably related to https://github.com/pyinstaller/pyinstaller/issues/7229

Can you run the bot with -v and past the complete error stacktrace here.

russellporter commented 1 month ago

@sebthom here's the backtrace (I have installed your project on macos):

[DEBUG] Closing Browser session...
[ERROR] Traceback (most recent call last):
  File "urllib/request.py", line 1344, in do_open
  File "http/client.py", line 1327, in request
  File "http/client.py", line 1373, in _send_request
  File "http/client.py", line 1322, in endheaders
  File "http/client.py", line 1081, in _send_output
  File "http/client.py", line 1025, in send
  File "http/client.py", line 1468, in connect
  File "ssl.py", line 455, in wrap_socket
  File "ssl.py", line 1046, in _create
  File "ssl.py", line 1321, in do_handshake
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "kleinanzeigen_bot/__main__.py", line 9, in <module>
  File "kleinanzeigen_bot/__init__.py", line 898, in main
  File "asyncio/base_events.py", line 684, in run_until_complete
  File "kleinanzeigen_bot/__init__.py", line 114, in run
  File "kleinanzeigen_bot/__init__.py", line 857, in download_ads
  File "kleinanzeigen_bot/extract.py", line 49, in download_ad
  File "kleinanzeigen_bot/extract.py", line 246, in _extract_ad_page_info
  File "kleinanzeigen_bot/extract.py", line 83, in _download_images_from_ad_page
  File "urllib/request.py", line 240, in urlretrieve
  File "urllib/request.py", line 215, in urlopen
  File "urllib/request.py", line 515, in open
  File "urllib/request.py", line 532, in _open
  File "urllib/request.py", line 492, in _call_chain
  File "urllib/request.py", line 1392, in https_open
  File "urllib/request.py", line 1347, in do_open
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)>
sebthom commented 1 month ago

Thanks for the stacktrace. I pushed a patch that hopefully fixes the issue. Please try the latest release.