Files
edx-platform/lms/djangoapps/utils.py
Waheed Ahmad 541065c542 fix: [VAN-980] changing the email address sync with Braze (#30590)
Currently, changing the email address in LMS does not reflect in Braze
and the transaction emails sent through Braze are delivering to user's
old/previous email address.

Added a signal/receiver to sync the new email address upon confirm email
change.
2022-06-15 19:39:23 +05:00

34 lines
754 B
Python

"""
Helper Methods
"""
from braze.client import BrazeClient
from django.conf import settings
def _get_key(key_or_id, key_cls):
"""
Helper method to get a course/usage key either from a string or a key_cls,
where the key_cls (CourseKey or UsageKey) will simply be returned.
"""
return (
key_cls.from_string(key_or_id)
if isinstance(key_or_id, str)
else key_or_id
)
def get_braze_client():
""" Returns a Braze client. """
braze_api_key = settings.EDX_BRAZE_API_KEY
braze_api_url = settings.EDX_BRAZE_API_SERVER
if not braze_api_key or not braze_api_url:
return None
return BrazeClient(
api_key=braze_api_key,
api_url=braze_api_url,
app_id='',
)