vosk-api icon indicating copy to clipboard operation
vosk-api copied to clipboard

Urlretrieve usage causes certificate error

Open yilun11 opened this issue 8 months ago • 4 comments

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")

yilun11 avatar Oct 31 '23 01:10 yilun11

What is Windows version please? something very old?

nshmyrev avatar Oct 31 '23 21:10 nshmyrev

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.

yilun11 avatar Oct 31 '23 22:10 yilun11

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

nshmyrev avatar Oct 31 '23 23:10 nshmyrev

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.

yilun11 avatar Nov 01 '23 02:11 yilun11