Hosts should be optional in connect function
heindrickdumdum0217 opened this issue · 1 comments
heindrickdumdum0217 commented
https://github.com/wallneradam/esorm/blob/main/esorm/esorm.py#L37
hosts parameter should be optional in the connect function.
In the underlying library (elasticsearch-py), we can connect using cloud_id and api_key.
If I pass empty hosts, it throws the following error.
from esorm import connect
async def init_es():
await connect(
hosts=[],
cloud_id="cloud_id",
api_key="api_key"
)
ValueError: The 'cloud_id' and 'hosts' parameters are mutually exclusive
If I pass None
to hosts parameter it works, but Pycharm
shows typing warning and fail in mypy
.
The following screenshot is from the elasticsearch-py documentation.
wallneradam commented
It is solved in v0.6.1. You can pass None
for hosts
. It is still not optional, but won't show you typing problem.