I was able to resolve this issue at my end by following below steps:
-
Visit https://api.openai.com/v1/engines from the browser and cancel the password prompt
-
Click on the lock icon on near the browser url to get the certificate info
-
Depending on your browser find the certificate details and download the root certificate file. For chrome click on connection is secure → Certificate is valid → Details tab and select the top most certificate and click export.
-
Once downloaded move it to the folder where you need it stored
-
Add the below code in your main app code to set the environment variable pointing to this certificate we downloaded
import os
os.environ['REQUESTS_CA_BUNDLE'] = '/path/to/certificate.crt'
OR
you can create a .env file in the local folder of your app with below line in it
REQUESTS_CA_BUNDLE = ‘/path/to/certificate.crt’
and load the environment variables in your code file using below code
from dotenv import load_dotenv
load_dotenv()
- Once environmental variable is set, openai library in python will use this certificate file for validation automatically and will resolve the issue.
I hope steps would help to resolve the issue for anyone facing it.