# How to bypass the SSL error

**URL:** <https://discuss.ai.google.dev/t/how-to-bypass-the-ssl-error/2563>\
**Category:** Gemini API\
**Tags:** api\
**Created:** [May 17, 2024, 10:05am UTC](https://discuss.ai.google.dev/t/how-to-bypass-the-ssl-error/2563 "2024-05-17T10:05:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qu\_c\_Tu\_n\_Nguy\_n](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/qu_c_tu_n_nguy_n/32/2532_2.png) [@Qu\_c\_Tu\_n\_Nguy\_n](https://discuss.ai.google.dev/u/Qu_c_Tu_n_Nguy_n)\
**Post date:** [May 17, 2024, 10:05am UTC](https://discuss.ai.google.dev/t/how-to-bypass-the-ssl-error/2563/1 "2024-05-17T10:05:35Z")

</div>

I got the error  
E0517 16:14:17.611000000 26592 src/core/tsi/ssl\_transport\_security.cc:1653] Handshake failed with fatal error SSL\_ERROR\_SSL: error:1000007d:SSL routines:OPENSSL\_internal:CERTIFICATE\_VERIFY\_FAILED.

when I ran the gemini suggested code:  
“”"  
Install the Google AI Python SDK

$ pip install google-generativeai

See the getting started guide for more information:

> **[Gemini API quickstart  |  Google AI for Developers](https://ai.google.dev/gemini-api/docs/quickstart)**
>
> Get started with the Gemini API for Developers

“”"

import os

import google.generativeai as genai

genai.configure(api\_key=os.environ[“GEMINI\_API\_KEY”])

# Create the model

# See [https://ai.google.dev/api/python/google/generativeai/GenerativeModel](https://ai.google.dev/api/python/google/generativeai/GenerativeModel)

generation\_config = {  
“temperature”: 1,  
“top\_p”: 0.95,  
“top\_k”: 64,  
“max\_output\_tokens”: 8192,  
“response\_mime\_type”: “text/plain”,  
}  
safety\_settings = [  
{  
“category”: “HARM\_CATEGORY\_HARASSMENT”,  
“threshold”: “BLOCK\_MEDIUM\_AND\_ABOVE”,  
},  
{  
“category”: “HARM\_CATEGORY\_HATE\_SPEECH”,  
“threshold”: “BLOCK\_MEDIUM\_AND\_ABOVE”,  
},  
{  
“category”: “HARM\_CATEGORY\_SEXUALLY\_EXPLICIT”,  
“threshold”: “BLOCK\_MEDIUM\_AND\_ABOVE”,  
},  
{  
“category”: “HARM\_CATEGORY\_DANGEROUS\_CONTENT”,  
“threshold”: “BLOCK\_MEDIUM\_AND\_ABOVE”,  
},  
]

model = genai.GenerativeModel(  
model\_name=“gemini-1.5-flash-latest”,  
safety\_settings=safety\_settings,  
generation\_config=generation\_config,  
)

chat\_session = model.start\_chat(  
history=[  
]  
)

response = chat\_session.send\_message(“INSERT\_INPUT\_HERE”)

print(response.text)  
print(chat\_session.history)

What should I do to resolve this problem on python?

---

<div class="post-metadata">

**Author:** ![afirstenberg](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/afirstenberg/32/202_2.png) [@afirstenberg](https://discuss.ai.google.dev/u/afirstenberg)\
**Post date:** [May 18, 2024, 4:52am UTC](https://discuss.ai.google.dev/t/how-to-bypass-the-ssl-error/2563/2 "2024-05-18T04:52:40Z")

</div>

This often suggests that you have a proxy or something similar that your machine is trying to connect to.
