@@ -42,15 +42,18 @@ Protocol v1 Authentication
|
|||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
When working with Cassandra 1.2 (or a higher version with
|
When working with Cassandra 1.2 (or a higher version with
|
||||||
:attr:`~.Cluster.protocol_version` set to ``1``), you will not pass in
|
:attr:`~.Cluster.protocol_version` set to ``1``), you will not pass in
|
||||||
an :class:`~.AuthProvider` instance. Instead, you should pass a dict
|
an :class:`~.AuthProvider` instance. Instead, you should pass in a
|
||||||
of credentials with a ``username`` and ``password`` key:
|
function that takes one argument, the IP address of a host, and returns
|
||||||
|
a dict of credentials with a ``username`` and ``password`` key:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from cassandra.cluster import Cluster
|
from cassandra.cluster import Cluster
|
||||||
|
|
||||||
credentials = {'username': 'joe', 'password': '1234'}
|
def get_credentials(host_address):
|
||||||
cluster = Cluster(auth_provider=credentials, protocol_version=1)
|
return {'username': 'joe', 'password': '1234'}
|
||||||
|
|
||||||
|
cluster = Cluster(auth_provider=get_credentials, protocol_version=1)
|
||||||
|
|
||||||
SSL
|
SSL
|
||||||
---
|
---
|
||||||
|
Reference in New Issue
Block a user