Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating import paths for twilio package >6.x #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions deux/notifications.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion deux/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)