I want to use Python in Elasticsearch. So I wrote an Authentication code in Python for Elasticsearch. But I'm getting the error "TypeError: 'Session' object is not callable". Here's the code:
import requests
from requests import Session
from requests.auth import HTTPBasicAuth
uname = 'elastic'
pswd = 'elastic'
session = requests.Session()
session.auth = HTTPBasicAuth(uname, pswd)
res = requests.get('http://localhost:9200',auth=session)
print(res.content)
Where am I going wrong?
requestsas tag to your question?