@@ -119,9 +119,9 @@ The driver configuration:
119119.. code-block :: python
120120
121121 from cassandra.cluster import Cluster, Session
122- from ssl import SSLContext, PROTOCOL_TLSv1
122+ from ssl import SSLContext, PROTOCOL_TLS
123123
124- ssl_context = SSLContext(PROTOCOL_TLSv1 )
124+ ssl_context = SSLContext(PROTOCOL_TLS )
125125
126126 cluster = Cluster([' 127.0.0.1' ], ssl_context = ssl_context)
127127 session = cluster.connect()
@@ -147,9 +147,9 @@ to `CERT_REQUIRED`. Otherwise, the loaded verify certificate will have no effect
147147.. code-block :: python
148148
149149 from cassandra.cluster import Cluster, Session
150- from ssl import SSLContext, PROTOCOL_TLSv1 , CERT_REQUIRED
150+ from ssl import SSLContext, PROTOCOL_TLS , CERT_REQUIRED
151151
152- ssl_context = SSLContext(PROTOCOL_TLSv1 )
152+ ssl_context = SSLContext(PROTOCOL_TLS )
153153 ssl_context.load_verify_locations(' /path/to/rootca.crt' )
154154 ssl_context.verify_mode = CERT_REQUIRED
155155
@@ -161,9 +161,9 @@ Additionally, you can also force the driver to verify the `hostname` of the serv
161161.. code-block :: python
162162
163163 from cassandra.cluster import Cluster, Session
164- from ssl import SSLContext, PROTOCOL_TLSv1 , CERT_REQUIRED
164+ from ssl import SSLContext, PROTOCOL_TLS , CERT_REQUIRED
165165
166- ssl_context = SSLContext(PROTOCOL_TLSv1 )
166+ ssl_context = SSLContext(PROTOCOL_TLS )
167167 ssl_context.load_verify_locations(' /path/to/rootca.crt' )
168168 ssl_context.verify_mode = CERT_REQUIRED
169169 ssl_context.check_hostname = True
@@ -228,9 +228,9 @@ Finally, you can use that configuration with the following driver code:
228228.. code-block:: python
229229
230230 from cassandra.cluster import Cluster, Session
231- from ssl import SSLContext, PROTOCOL_TLSv1
231+ from ssl import SSLContext, PROTOCOL_TLS
232232
233- ssl_context = SSLContext(PROTOCOL_TLSv1 )
233+ ssl_context = SSLContext(PROTOCOL_TLS )
234234 ssl_context.load_cert_chain(
235235 certfile='/path/to/client.crt_signed',
236236 keyfile='/path/to/client.key')
@@ -251,9 +251,9 @@ The following driver code specifies that the connection should use two-way verif
251251.. code-block:: python
252252
253253 from cassandra.cluster import Cluster, Session
254- from ssl import SSLContext, PROTOCOL_TLSv1 , CERT_REQUIRED
254+ from ssl import SSLContext, PROTOCOL_TLS , CERT_REQUIRED
255255
256- ssl_context = SSLContext(PROTOCOL_TLSv1 )
256+ ssl_context = SSLContext(PROTOCOL_TLS )
257257 ssl_context.load_verify_locations('/path/to/rootca.crt')
258258 ssl_context.verify_mode = CERT_REQUIRED
259259 ssl_context.load_cert_chain(
@@ -275,7 +275,7 @@ for more details about ``SSLContext`` configuration.
275275 from cassandra.cluster import Cluster
276276 from cassandra.io.twistedreactor import TwistedConnection
277277
278- ssl_context = SSL.Context(SSL.TLSv1_METHOD )
278+ ssl_context = SSL.Context(SSL.TLSv1_2_METHOD )
279279 ssl_context.set_verify(SSL.VERIFY_PEER, callback=lambda _1, _2, _3, _4, ok: ok)
280280 ssl_context.use_certificate_file('/path/to/client.crt_signed')
281281 ssl_context.use_privatekey_file('/path/to/client.key')
@@ -303,19 +303,19 @@ deprecated in the next major release.
303303
304304By default, a ` ` ca_certs` ` value should be supplied (the value should be
305305a string pointing to the location of the CA certs file), and you probably
306- want to specify ` ` ssl_version` ` as ` ` ssl.PROTOCOL_TLSv1 ` ` to match
306+ want to specify ` ` ssl_version` ` as ` ` ssl.PROTOCOL_TLS ` ` to match
307307Cassandra's default protocol.
308308
309309For example:
310310
311311.. code-block:: python
312312
313313 from cassandra.cluster import Cluster
314- from ssl import PROTOCOL_TLSv1 , CERT_REQUIRED
314+ from ssl import PROTOCOL_TLS , CERT_REQUIRED
315315
316316 ssl_opts = {
317317 'ca_certs': '/path/to/my/ca.certs',
318- 'ssl_version': PROTOCOL_TLSv1 ,
318+ 'ssl_version': PROTOCOL_TLS ,
319319 'cert_reqs': CERT_REQUIRED # Certificates are required and validated
320320 }
321321 cluster = Cluster(ssl_options=ssl_opts)
0 commit comments