sym.sdk.integrations.sym

Helpers for interacting with the Sym platform itself from within the Sym SDK.

Functions

get_or_create_user_by_email(email)

For the given email address, retrieve the Sym User if one exists, or create a new Sym User if none exists.

get_or_create_users_by_emails(emails[, ...])

For each of the given list of email addresses, retrieve the corresponding Sym User if one exists, or create a new one otherwise.

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 Sym User 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 is True, 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 contain Nones.

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 to False.

Returns

A list of Sym Users corresponding to the given email addresses.

Raises

SymIntegrationError – If raise_on_error is True and any errors occur while processing the list of emails, or if any other error occurs.