Full error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1028)

when i am trying to use gemini model on local windows machine im getting the bellow error

here is my code snippet

import os
import warnings
from google import genai
from google.genai import types

http_options = types.HttpOptions(
client_args={“verify”: False} # Disables cert verification in httpx.Client
)

client = genai.Client(
api_key=os.getenv(“GEMINI_API_KEY”, “xxxxx”),
http_options=http_options
)

response = client.models.generate_content(
model=“gemini-2.5-flash”,
contents=“Hello”
)

getting the bellow error

[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1028)

Hi @Lalit_Moharana
Welcome to the AI Forum!!!

Thank you for reaching out.
Disabling verification with verify=False may not always resolve the issue. Please ensure that the SSL_CERT_FILE environment variable is set correctly on your system. You can do this by running the following command: export SSL_CERT_FILE='client.pem'

If this does not resolve your problem, Than please updating certifi, Python, or running in a clean virtual environment.