# How to use elasticsearch-py to test elastic client using authentication

**URL:** <https://discuss.elastic.co/t/how-to-use-elasticsearch-py-to-test-elastic-client-using-authentication/235233>\
**Category:** Elasticsearch\
**Created:** [June 1, 2020, 8:58pm UTC](https://discuss.elastic.co/t/how-to-use-elasticsearch-py-to-test-elastic-client-using-authentication/235233 "2020-06-01T20:58:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JyL](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jyl/32/53869_2.png) [@JyL](https://discuss.elastic.co/u/JyL)\
**Post date:** [June 1, 2020, 8:58pm UTC](https://discuss.elastic.co/t/how-to-use-elasticsearch-py-to-test-elastic-client-using-authentication/235233/1 "2020-06-01T20:58:40Z")

</div>

Hey,  
I am trying to test elastic client using authentications with the elasticsearch-py.

I use the trial license and connect to AD for my team.

reference here [https://github.com/elastic/elasticsearch-py](https://github.com/elastic/elasticsearch-py)

```auto
>>> from elasticsearch import Elasticsearch
>>> from ssl import create_default_context

>>> context = create_default_context(cafile="path/to/cafile.pem")
>>> es = Elasticsearch("https://elasticsearch.url:port", ssl_context=context, http_auth=('elastic','yourpassword'))
>>> es.info()

```

what should I do with ssl\_context or the cafile?

---

<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:** [June 29, 2020, 8:58pm UTC](https://discuss.elastic.co/t/how-to-use-elasticsearch-py-to-test-elastic-client-using-authentication/235233/2 "2020-06-29T20:58:48Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
