python
config = {
'hosts': hosts,
'policies': {'auth_mode': aerospike.AUTH_INTERNAL},
'user': user,
'password': password
}
client = aerospike.client(config)
following is no-op
client.connect(user, password)
Having the client connect to the server when the constructor is called makes the Python client's behavior more
consistent with our other clients, and it also removes the possibility of an application trying to perform server
operations with the client without a connection.
If you are using a `try/except` block and have the constructor call outside of the `try` block, move
the constructor call into the `try` block. If an exception happens, it would be coming from the
constructor and not the connect() method.
This line of code:
python
client = aerospike.client(config).connect()
should not have an issue.
But code such as this:
python
client = aerospike.client(config)
try:
client.connect()
except Exception:
eat exception and do something
Should be changed to this instead:
python
try:
client = aerospike.client(config)
except Exception:
eat exception and do something
[CLIENT-1863] Build using pyproject.toml (298)
The commands to build and install the client for developers has changed from:
sh
python3 setup.py build --force
python3 setup.py install --force
to:
sh
pip install build
python3 -m build
pip install .