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 (#175)

Closes #174.
  • Loading branch information
wbarnha committed Mar 27, 2024
1 parent cbf317b commit af1a5f0
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 af1a5f0

Please sign in to comment.