from os import environ
import certifi
def print_env():
print(f"REQUESTS_CA_CERT is {environ.get('REQUESTS_CA_CERT')}")
def set_env():
cafile = certifi.where()
print(f"CA file is {cafile}")
environ['REQUESTS_CA_CERT'] = cafile
print("set_env() done!")
def download():
import nltk
print("About to call nltk.download()!")
nltk.download()
if __name__ == '__main__':
print_env()
set_env()
print_env()
download()
pipenv run python extras/check_ssl.py
Loading .env environment variables…
REQUESTS_CA_CERT is None
CA file is /Users/anseljh/.local/share/virtualenvs/project-name-s7XLw6jn/lib/python3.6/site-packages/certifi/cacert.pem
set_env() done!
REQUESTS_CA_CERT is /Users/anseljh/.local/share/virtualenvs/project-name-s7XLw6jn/lib/python3.6/site-packages/certifi/cacert.pem
About to call nltk.download()!
showing info https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/index.xml