Request Error in opensearch-py OpenSearch client exists(), create(), index()... methods

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
opensearch-py version 2.0.0
python version 3.9.2
Debian GNU/Linux 11 (bullseye)

Describe the issue:
When I run OpenSearch client’s exists() function, I get a request error. The id I’m checking for does exist in the cluster though. I get a similar error when I run the create() and index() methods. The code and error message are below:

from opensearchpy import OpenSearch, RequestsHttpConnection
host = '<host link>'
port = 443
auth = ("username", "password")

# create an opensearch client
client = OpenSearch(
        hosts = [{'host': host, 'port': port}],
        http_auth = auth,
        use_ssl = True,
        verify_certs = True,
        connection_class = RequestsHttpConnection)

result = client.exists(index="test_index", id=1)

Error:

opensearchpy.exceptions.RequestError: RequestError(400, 'no handler found for uri [/:443/test_index/_doc/1] and method [GET]', 'no handler found for uri [/:443/test_index/_doc/1] and method [GET]')

I get a similar issue when I use the .create() and .index() methods, but the error has [PUT] instead of [GET].

The bulk() method is working fine for me though and I was able to upload to the cluster using that method, so I believe my client object is configured fine.

Is it possible you have a “/” on the end of your host link, which is causing the port to look like it’s a path when they are appended together?

That’s exactly what the issue was. Thank you!