opensearch-project / opensearch-py

Python Client for OpenSearch
https://opensearch.org/docs/latest/clients/python/
Apache License 2.0
359 stars 178 forks source link

[BUG] IAM auth documentation issues #560

Closed chjno closed 1 year ago

chjno commented 1 year ago

What is the bug?

When I follow the instructions in auth.md, I get the following errors

cannot import name 'Urllib3AWSV4SignerAuth' from 'opensearchpy'
cannot import name 'RequestHttpConnection' from 'opensearchpy' 
cannot import name 'RequestsAWSV4SignerAuth' from 'opensearchpy' 

It seems to work when I replace instances of Urllib3AWSV4SignerAuth with AWSV4SignerAuth.

How can one reproduce the bug?

  1. Copying the example code and running it.
  2. Replacing Urllib3HttpConnection, Urllib3AWSV4SignerAuth in line 1 with RequestHttpConnection, RequestsAWSV4SignerAuth.
  3. Replacing RequestHttpConnection in line 1 with RequestsHttpConnection.

What is the expected behavior?

No import errors and successful OpenSearch API requests.

dblock commented 1 year ago

Support for Urllib3 Sigv4 was added in https://github.com/opensearch-project/opensearch-py/pull/547 and just hasn't been released yet. Add your +1 top https://github.com/opensearch-project/opensearch-py/issues/561.

You can use opensearch-py from HEAD if you want to try it out!