diff --git a/deux/notifications.py b/deux/notifications.py index 50a9c1d..d9f3384 100644 --- a/deux/notifications.py +++ b/deux/notifications.py @@ -1,7 +1,18 @@ from __future__ import absolute_import, unicode_literals -from twilio.rest import TwilioRestClient -from twilio.rest.exceptions import TwilioRestException +try: + from twilio.rest import Client as TwilioRestClient +except ImportError: + from twilio.rest import TwilioRestClient + print("DeprecationWarning: Importing TwilioRestClient from twilio.rest" + " is deprecated. Update twilio package to >6.x") + +try: + from twilio.base.exceptions import TwilioRestException +except ImportError: + from twilio.rest.exceptions import TwilioRestException + print("DeprecationWarning: Importing TwilioRestException from twilio.rest" + " is deprecated. Update twilio package to >6.x") from deux import strings from deux.app_settings import mfa_settings diff --git a/deux/validators.py b/deux/validators.py index 60ddd1b..265d373 100644 --- a/deux/validators.py +++ b/deux/validators.py @@ -6,5 +6,5 @@ #: Regex validator for phone numbers. phone_number_validator = RegexValidator( - regex=r"^(\d{7,15})$", + regex=r"^\+[1-9]\d{1,14}$", message=strings.INVALID_PHONE_NUMBER_ERROR)