alphacep / vosk-api

Offline speech recognition API for Android, iOS, Raspberry Pi and servers with Python, Java, C# and Node
Apache License 2.0
7.37k stars 1.04k forks source link

Urlretrieve usage causes certificate error #1456

Closed yilun11 closed 1 month ago

yilun11 commented 8 months ago

Related to issue #1015, I think the problem is line 117 in vosk-api\python\vosk\__init__.py

urlretrieve(MODEL_PRE_URL + str(model_name.name) + ".zip", str(model_name) + ".zip", reporthook=reporthook, data=None)

An alternative like requests.get() works fine.

To replicate (on Windows, Py 3.11.5) following throws CERTIFICATE_VERIFY_FAILED:

from urllib.request import urlretrieve

urlretrieve("https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip", "d:\temp.zip")

This does not throw the error:

import requests

file = requests.get("https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip")
nshmyrev commented 8 months ago

What is Windows version please? something very old?

yilun11 commented 8 months ago

I am on Windows 11 Home Version 10.0.22624 Build 22624. I've seen other issues with certs, and think requests with certifi is the better approach.

nshmyrev commented 8 months ago

Ok, thanks. I can check a bit later if time permits. Getting a good certificate from proper authority is the right way of course.

yilun11 commented 8 months ago

I think the certificate has the cross signed with expired DST Root CA X3 issue, which would explain the expiration error thrown. Unsure if this is a known issue on urllib and resolved in requests on the Windows platform.

nshmyrev commented 1 month ago

Same as https://github.com/alphacep/vosk-api/issues/1137