sym.sdk.integrations.sym¶
Helpers for interacting with the Sym platform itself from within the Sym SDK.
Functions
|
For the given email address, retrieve the Sym |
|
For each of the given list of email addresses, retrieve the corresponding Sym |
- sym.sdk.integrations.sym.get_or_create_user_by_email(email: str) sym.sdk.user.User ¶
For the given email address, retrieve the Sym
User
if one exists, or create a new SymUser
if none exists.If the user was not found and could not be created, or another error occurred (e.g., an invalid email address was specified), this function will instead raise an exception. It will never return
None
.- Parameters
email – The email address of the user to retrieve or create.
- Returns
The Sym
User
corresponding to the given email address.- Raises
SymIntegrationError – If the user could not be retrieved or created, or if the email address is invalid, or on any other error.
- sym.sdk.integrations.sym.get_or_create_users_by_emails(emails: List[str], raise_on_error: bool = False) List[sym.sdk.user.User] ¶
For each of the given list of email addresses, retrieve the corresponding Sym
User
if one exists, or create a new one otherwise.If
raise_on_error
isTrue
, then any “routine” errors that occur while processing the list of emails (for example, an invalid email was specified or a user could not be found and failed to be created) will be raised as an exception. Otherwise, the errors will be logged as warnings and the corresponding user will be omitted from the output. The returned list of users will never containNone
s.Regardless of the value of
raise_on_error
, serious errors (such as a communication failure within the Sym platform or malformed input) will always be raised as exceptions.- Parameters
emails – A list of email addresses of the users to retrieve or create. Must not contain any
None
values.raise_on_error – Whether to raise an exception if an error occurs while processing the list of emails. If
False
, errors will be logged as warnings and the corresponding user will be omitted from the output. Defaults toFalse
.
- Returns
A list of Sym
User
s corresponding to the given email addresses.- Raises
SymIntegrationError – If
raise_on_error
isTrue
and any errors occur while processing the list of emails, or if any other error occurs.