Fix v1 protocol authentication example

Relates to #128
This commit is contained in:
Tyler Hobbs
2014-06-24 12:14:10 -05:00
parent c1fa1bfc42
commit 71b1613d24

View File

@@ -42,15 +42,18 @@ Protocol v1 Authentication
^^^^^^^^^^^^^^^^^^^^^^^^^^
When working with Cassandra 1.2 (or a higher version with
:attr:`~.Cluster.protocol_version` set to ``1``), you will not pass in
an :class:`~.AuthProvider` instance. Instead, you should pass a dict
of credentials with a ``username`` and ``password`` key:
an :class:`~.AuthProvider` instance. Instead, you should pass in a
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
from cassandra.cluster import Cluster
credentials = {'username': 'joe', 'password': '1234'}
cluster = Cluster(auth_provider=credentials, protocol_version=1)
def get_credentials(host_address):
return {'username': 'joe', 'password': '1234'}
cluster = Cluster(auth_provider=get_credentials, protocol_version=1)
SSL
---