# How do I fix TLS Error when connecting with Python?

**URL:** <https://discuss.elastic.co/t/how-do-i-fix-tls-error-when-connecting-with-python/307922>\
**Category:** Elasticsearch\
**Created:** [June 22, 2022, 9:04pm UTC](https://discuss.elastic.co/t/how-do-i-fix-tls-error-when-connecting-with-python/307922 "2022-06-22T21:04:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DataStorageMuse](https://avatars.discourse-cdn.com/v4/letter/d/bcef8e/32.png) [@DataStorageMuse](https://discuss.elastic.co/u/DataStorageMuse)\
**Post date:** [June 22, 2022, 9:04pm UTC](https://discuss.elastic.co/t/how-do-i-fix-tls-error-when-connecting-with-python/307922/1 "2022-06-22T21:04:12Z")

</div>

When I try to connect to Elasticsearch with Python Client, I get this error: `elastic_transport.TlsError: TLS error caused by: TlsError(TLS error caused by: SSLError([SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:997)))` . I can successfully open localhost:9200 in the browser, and the curl requests are working. How do I fix this?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [June 23, 2022, 6:08am UTC](https://discuss.elastic.co/t/how-do-i-fix-tls-error-when-connecting-with-python/307922/2 "2022-06-23T06:08:09Z")

</div>

Please don't open multiple topics on the same question -[How do I fix TLS Error when connecting with Python Client?](https://discuss.elastic.co/t/how-do-i-fix-tls-error-when-connecting-with-python-client/307916)

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [June 23, 2022, 6:08am UTC](https://discuss.elastic.co/t/how-do-i-fix-tls-error-when-connecting-with-python/307922/3 "2022-06-23T06:08:15Z")

</div>


