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

**URL:** <https://discuss.elastic.co/t/how-do-i-fix-tls-error-when-connecting-with-python-client/307916>\
**Category:** Elasticsearch\
**Created:** [June 22, 2022, 7:26pm UTC](https://discuss.elastic.co/t/how-do-i-fix-tls-error-when-connecting-with-python-client/307916 "2022-06-22T19:26:29Z")\
**Posts on this page:** 4\
**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, 7:26pm UTC](https://discuss.elastic.co/t/how-do-i-fix-tls-error-when-connecting-with-python-client/307916/1 "2022-06-22T19:26:29Z")

</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:** ![sudhagar\_ramesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sudhagar_ramesh/32/105673_2.png) [@sudhagar\_ramesh](https://discuss.elastic.co/u/sudhagar_ramesh)\
**Post date:** [June 23, 2022, 2:53am UTC](https://discuss.elastic.co/t/how-do-i-fix-tls-error-when-connecting-with-python-client/307916/2 "2022-06-23T02:53:57Z")

</div>

Hello @DataStorageMuse

Are you connecting to the es with this below code syntax

```auto
es = Elasticsearch([<ES-url>], http_auth=(username, password))

```

---

<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:09am UTC](https://discuss.elastic.co/t/how-do-i-fix-tls-error-when-connecting-with-python-client/307916/3 "2022-06-23T06:09:58Z")

</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/307907)

---

<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:10am UTC](https://discuss.elastic.co/t/how-do-i-fix-tls-error-when-connecting-with-python-client/307916/4 "2022-06-23T06:10:01Z")

</div>


