# SSL error when using python api

**URL:** <https://discuss.elastic.co/t/ssl-error-when-using-python-api/25121>\
**Category:** Elasticsearch\
**Created:** [July 8, 2015, 7:31am UTC](https://discuss.elastic.co/t/ssl-error-when-using-python-api/25121 "2015-07-08T07:31:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ella\_Soomla](https://avatars.discourse-cdn.com/v4/letter/e/f17d59/32.png) [@Ella\_Soomla](https://discuss.elastic.co/u/Ella_Soomla)\
**Post date:** [July 8, 2015, 7:31am UTC](https://discuss.elastic.co/t/ssl-error-when-using-python-api/25121/1 "2015-07-08T07:31:05Z")

</div>

Hi,  
I'm able to run queries to my elasticsearch cluster using sense and command line.  
However, when I try to use the python api to run the same queries, I keep getting the following error:

elasticsearch.exceptions.SSLError: ConnectionError(EOF occurred in violation of protocol (\_ssl.c:581)) caused by: SSLError(EOF occurred in violation of protocol (\_ssl.c:581))

This is how I create the elasticsearch object:

```
es = Elasticsearch(
      'myhostadress:9200',
       use_ssl=True,
       verify_certs=True
)

```

which returns with no errors, but every function I try to run on it (es.search(...), es.count(...), es.cluster.health(...)) fails with the SSL error. I tried not using ssl and changing the ssl version, but the result is the same.  
I also tries using the elasticsearch-DSL api, same error occured/  
Any help is appreciated!

---

<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:** [July 9, 2015, 12:51am UTC](https://discuss.elastic.co/t/ssl-error-when-using-python-api/25121/2 "2015-07-09T00:51:22Z")

</div>

What handles the SSL on the ES side?

---

<div class="post-metadata">

**Author:** ![Ella\_Soomla](https://avatars.discourse-cdn.com/v4/letter/e/f17d59/32.png) [@Ella\_Soomla](https://discuss.elastic.co/u/Ella_Soomla)\
**Post date:** [July 9, 2015, 6:59am UTC](https://discuss.elastic.co/t/ssl-error-when-using-python-api/25121/3 "2015-07-09T06:59:36Z")

</div>

So, apparently nothing does (I'm not managing the es cluster, just querying it)  
After changing myhostaddress from https to http and changing use\_ssl=False I am able to run my queries  
Thanks for the response!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:02am UTC](https://discuss.elastic.co/t/ssl-error-when-using-python-api/25121/4 "2017-07-06T00:02:39Z")

</div>


