Skip to content

Commit

Permalink
Update __init__.py of SASL to catch ImportErrors in case botocore is …
Browse files Browse the repository at this point in the history
…not installed (dpkp#175)

Closes wbarnha#174.
  • Loading branch information
wbarnha authored and bradenneal1 committed May 16, 2024
1 parent 0331ddc commit ceb46e2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions kafka/sasl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import logging

from kafka.sasl import gssapi, oauthbearer, plain, scram, msk

log = logging.getLogger(__name__)
from kafka.sasl import gssapi, oauthbearer, plain, scram

MECHANISMS = {
'GSSAPI': gssapi,
'OAUTHBEARER': oauthbearer,
'PLAIN': plain,
'SCRAM-SHA-256': scram,
'SCRAM-SHA-512': scram,
'AWS_MSK_IAM': msk,
}

try:
from kafka.sasl import msk
MECHANISMS['AWS_MSK_IAM'] = msk
except ImportError:
pass

log = logging.getLogger(__name__)


def register_mechanism(key, module):
"""
Expand Down

0 comments on commit ceb46e2

Please sign in to comment.