elasticsearch-dbapi icon indicating copy to clipboard operation
elasticsearch-dbapi copied to clipboard

Unclear how to get past Basic Authentication

Open provtemp opened this issue 2 years ago • 1 comments

It is not clear to me how to query an endpoint that uses HTTP Basic Authentication. I tried

    engine = create_engine(
        "elasticsearch+https://.../",
        connect_args={"password": credentials.password, "user": credentials.login},
    )

but that neither puts an Authorization header in the request, nor does it automatically retry with one upon receiving the HTTP/1.1 401 Unauthorized response, using

elastic-transport==8.0.1
elasticsearch==8.0.1
elasticsearch-dbapi==0.2.2
SQLAlchemy==1.4.32

There should at least be an example in the documentation.

provtemp avatar Mar 10 '22 22:03 provtemp

https://github.com/preset-io/elasticsearch-dbapi/blob/0d5a93058fc82071169f199bfae85d7b5162a12a/es/baseapi.py#L318

Removing ^ .transport seems to work.

provtemp avatar Mar 12 '22 16:03 provtemp