Youtube DL Unable to get local issuer certificate - CERTIFICATE_VERIFY_FAILED - python

I'm trying to use youtube DL with FFmpeg to download an m3u8 stream. Just recently I started receiving this error:
ERROR: Unable to download webpage: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED]
certificate verify failed: unable to get local issuer certificate (_ssl.c:992)>
(caused by URLError(SSLCertVerificationError(1,
'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed:
unable to get local issuer certificate (_ssl.c:992)')))
I know Youtube DL supports an option for nocheckcertificate but by enabling this after a couple of minutes the target machine will refuse the connection. When trying to use the same m3u8 stream on another computer, I could download the stream without any issues.
I know that someone from Youtubedl CERTIFICATE_VERIFY_FAILED suggested fixing "your system's CA certificate list". What is the process of doing this?
I tried upgrading/reinstalling python and reinstalling the latest Windows update
I also want to mention that there hasn't been any issue with downloading for the past year but recently stumbled upon this when switching proxy providers. But because the same setup works on another PC without any issue it's probably not the reason.
The system the program is running on is Windows
Edit: Another note is that downloading other public m3u8 streams works perfectly fine, so the problem is probably with the system CA SSL.

Related

For an unknown url - SSL Certificate error certificate verify failed: unable to get local issuer certificate (downloading data set )

I am working on a git-hub project in pycharm (Python v - 3.8) that generates a SSL Certificate, particularly for downloading a dataset. I tried the following method -
"import request requests.get('https://msd-for-monai.s3-us-west-2.amazonaws.com/', verify= False)"
It doesn't work and sends the same certificate error. I have tried all possible urls.
I want to know, if the url from which the error is generated is not known to us, how to solve the error issue.
And I am working from my office network with some restrictions

What exactly causes the "unable to get local issuer certificate" error when accessing an otherwise accessible (via browser) website URL?

I'm on macOS Monterey 12.3 running Python 3.9.7 installed via brew. Given this minimal replication of my production code:
import requests
try:
response = requests.get(website)
except requests.exceptions.SSLError as e:
print("Error: " + str(e))
... it spits out this error:
Error: HTTPSConnectionPool(host='<SNIP>', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))
Unfortunately, the website URL is something that I cannot share. But it's definitely accessible via HTTPS on Chrome. I'm aware of workarounds and have successfully fixed it by following this one, but I have deployed the same identical code on a Linux server and it errors out all the same (so I'm assuming this isn't a MacOS specific issue). Is this a misconfiguration of the SSL cert on the server? And if so, how is it fixed?

How to get local issuer certificate on wsl2?

I'm now stucking with SSL when using Windows SubSystem WSL2 Ubuntu. Specifically, I need to read table on website, and I'm using pandas.read_html(url). However, It warns me the Error like this
SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)
How can I solve this problem? What is the root of it?

How to Fix SSL Error on Windows 10 for Discord Bot

I have a Discord bot I've been running on a Windows 10 VM for several months, and yesterday it stopped working with the following error:
raise ClientConnectorCertificateError(aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discordapp.com:443
ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer cerificate (_ssl.c:1108)')]
The only fix I've found online is for MacOS which involves running a .command file.
Note: The bot can be run on my main PC, but it will not run on my secondary PC or any of my VMs.
Any help would be appreciated.
Thanks!
I opened discordapp.com in my browser and it suddenly worked.

Where does python library aiohttp/asyncio get its certificate store? [Ubuntu docker container]

I am running a docker container with Ubuntu as the base and am trying to add a new Certificate Authority to the project.
I'm not entirely sure what's failing, but I cannot seem to make it work. I followed the directions on this page: http://manpages.ubuntu.com/manpages/zesty/man8/update-ca-certificates.8.html by adding the CA file to a directory in /usr/share/ca-certificates, specifying the CA files in /etc/ca-certificates.conf, and then running update-ca-certificates, which completes with a message saying that it added 3 new certificates.
However, aiohttp is still printing the error
aiohttp.errors.ClientOSError: [Errno 1] Cannot connect to host www.myserver.com:443 ssl:True [Can not connect to www.myserver.com:443 [[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:719)]]
I was informed that aiohttp doesn't access a certificate store itself, but rather relies on asyncio which I think was absorbed into python itself recently. So I don't know if somewhere along the chain something is using a different certificate store, but I would just like to know where I can add my CA files so that they will work with aiohttp.

Categories