macos youtube dl unable to get local issuer certificate ssl c 3a1131

Solutions on MaxInterview for macos youtube dl unable to get local issuer certificate ssl c 3a1131 by the best coders in the world

showing results for - "macos youtube dl unable to get local issuer certificate ssl c 3a1131"
Isabell
13 Jan 2020
1# If you're using macOS go to 
2# Macintosh HD > Applications > Python3.6 folder (or whatever version of python you're using)
3# > double click on "Install Certificates.command" file. :D
4
5# If you installed python using homebrew, run the script below:
6
7# install_certifi.py
8#
9# sample script to install or update a set of default Root Certificates
10# for the ssl module.  Uses the certificates provided by the certifi package:
11#       https://pypi.python.org/pypi/certifi
12
13import os
14import os.path
15import ssl
16import stat
17import subprocess
18import sys
19
20STAT_0o775 = ( stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR
21             | stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP
22             | stat.S_IROTH |                stat.S_IXOTH )
23
24
25def main():
26    openssl_dir, openssl_cafile = os.path.split(
27        ssl.get_default_verify_paths().openssl_cafile)
28
29    print(" -- pip install --upgrade certifi")
30    subprocess.check_call([sys.executable,
31        "-E", "-s", "-m", "pip", "install", "--upgrade", "certifi"])
32
33    import certifi
34
35    # change working directory to the default SSL directory
36    os.chdir(openssl_dir)
37    relpath_to_certifi_cafile = os.path.relpath(certifi.where())
38    print(" -- removing any existing file or link")
39    try:
40        os.remove(openssl_cafile)
41    except FileNotFoundError:
42        pass
43    print(" -- creating symlink to certifi certificate bundle")
44    os.symlink(relpath_to_certifi_cafile, openssl_cafile)
45    print(" -- setting permissions")
46    os.chmod(openssl_cafile, STAT_0o775)
47    print(" -- update complete")
48
49if __name__ == '__main__':
50    main()
51