# Create Index with Python and Login

**URL:** <https://discuss.elastic.co/t/create-index-with-python-and-login/151838>\
**Category:** Elasticsearch\
**Created:** [October 10, 2018, 11:53am UTC](https://discuss.elastic.co/t/create-index-with-python-and-login/151838 "2018-10-10T11:53:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![adwaitjoshi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adwaitjoshi/32/35098_2.png) [@adwaitjoshi](https://discuss.elastic.co/u/adwaitjoshi)\
**Post date:** [October 10, 2018, 11:53am UTC](https://discuss.elastic.co/t/create-index-with-python-and-login/151838/1 "2018-10-10T11:53:17Z")

</div>

UPDATE. SOLVED by bypassing the RequestsHttpConnection

I am trying to create a index using python

import elasticsearch  
from elasticsearch import Elasticsearch,RequestsHttpConnection  
es = elasticsearch.Elasticsearch(['192.168.1.226:9200'],  
connection\_class=RequestsHttpConnection,  
verify\_certs=False,  
http\_auth=('admin','password'))  
es.indices.create(index=index\_name, ignore=400)

This seems to be giving me a bad status line error. I am not really a python guy but this is all I would have to do anyways to get my code working. What am I doing wrong?

---

<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:** [November 7, 2018, 12:03pm UTC](https://discuss.elastic.co/t/create-index-with-python-and-login/151838/2 "2018-11-07T12:03:01Z")

</div>

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