Skip to content

Commit fd02b7d

Browse files
author
Jun Yamasaki
committed
Add a constant to specify SSL_MODE.
1 parent b28e723 commit fd02b7d

File tree

6 files changed

+32
-2
lines changed

6 files changed

+32
-2
lines changed

MySQLdb/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
from ._mysql import *
2929
from MySQLdb.compat import PY2
30-
from MySQLdb.constants import FIELD_TYPE
30+
from MySQLdb.constants import FIELD_TYPE, SSL_MODE
3131
from MySQLdb.times import Date, Time, Timestamp, \
3232
DateFromTicks, TimeFromTicks, TimestampFromTicks
3333

MySQLdb/constants/SSL_MODE.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""MySQL SSL_MODE Constants
2+
3+
These constants are used to specify SSL_MODE.
4+
5+
"""
6+
7+
DISABLED = 1
8+
PREFERRED = 2
9+
REQUIRED = 3
10+
VERIFY_CA = 4
11+
VERIFY_IDENTITY = 5

MySQLdb/constants/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__all__ = ['CR', 'FIELD_TYPE','CLIENT','ER','FLAG']
1+
__all__ = ['CR', 'FIELD_TYPE','CLIENT','ER','FLAG','SSL_MODE']

doc/MySQLdb.constants.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,10 @@ constants Package
4949
:undoc-members:
5050
:show-inheritance:
5151

52+
:mod:`SSL_MODE` Module
53+
------------------
54+
55+
.. automodule:: MySQLdb.constants.SSL_MODE
56+
:members:
57+
:undoc-members:
58+
:show-inheritance:

doc/user_guide.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,17 @@ connect(parameters...)
357357

358358
*This must be a keyword parameter.*
359359

360+
ssl_mode
361+
If present, specify the security settings for the
362+
connection to the server. For more information on ssl_mode,
363+
see the MySQL documentation. The constants can be referenced
364+
as follows: ``MySQLdb.constants.PREFERRED``
365+
366+
If not present, the session ssl_mode will be unchanged,
367+
but it becomes PREFERRED in Version 5.7 or later.
368+
369+
*This must be a keyword parameter.*
370+
360371
ssl
361372
This parameter takes a dictionary or mapping, where the
362373
keys are parameter names used by the mysql_ssl_set_ MySQL

metadata.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ py_modules:
4040
MySQLdb.constants.ER
4141
MySQLdb.constants.FIELD_TYPE
4242
MySQLdb.constants.FLAG
43+
MySQLdb.constants.SSL_MODE

0 commit comments

Comments
 (0)