Forum Discussion
SSL Verification failed when trying to use OpenAI library
- 1 year ago
Hello govindarajan_d
give it a try
import httpx
client = openai.AzureOpenAI(
api_key=AZURE_OPENAI_API_KEY,
azure_endpoint=AZURE_OPENAI_ENDPOINT,
api_version=API_VERSION,
http_client=httpx.Client(verify="/path/to/your/custom_certificate.pem")
)not recommended for prod, but lets see if this works
Hello govindarajan_d
give it a try
import httpx
client = openai.AzureOpenAI(
api_key=AZURE_OPENAI_API_KEY,
azure_endpoint=AZURE_OPENAI_ENDPOINT,
api_version=API_VERSION,
http_client=httpx.Client(verify="/path/to/your/custom_certificate.pem")
)
not recommended for prod, but lets see if this works
Hi nilendraFabric,
The code worked, I pointed it to the existing certificate.
client = openai.AzureOpenAI(
api_key=AZURE_OPENAI_API_KEY,
azure_endpoint=AZURE_OPENAI_ENDPOINT,
api_version=API_VERSION,
http_client=httpx.Client(verify="/etc/ssl/certs/ca-certificates.crt"),
)
But why doesn't it work normally when other libraries like requests work without issues? Also, for production what would you suggest?