Skip to content

Commit 10ec296

Browse files
committed
fix: Regional API domain processing
1 parent 15e1ed6 commit 10ec296

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

twilio/base/client_base.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from twilio.http.response import Response
1111
from twilio.credential.credential_provider import CredentialProvider
1212

13-
warnings.simplefilter("always", DeprecationWarning)
1413

1514
class ClientBase(object):
1615
"""A client for accessing the Twilio API."""
@@ -46,7 +45,7 @@ def __init__(
4645
:param region: Twilio Region to make requests to, defaults to 'us1' if an edge is provided
4746
:param http_client: HttpClient, defaults to TwilioHttpClient
4847
:param environment: Environment to look for auth details, defaults to os.environ
49-
:param edge: (Deprecated) Twilio Edge to make requests to, defaults to None. Will be deprecated from 9.9.0. Twilio is moving towards regional processing. This will be removed from 10.x.x.
48+
:param edge: Twilio Edge to make requests to, defaults to None.
5049
:param user_agent_extensions: Additions to the user agent string
5150
:param credential_provider: credential provider for authentication method that needs to be used
5251
"""
@@ -57,12 +56,13 @@ def __init__(
5756
""" :type : str """
5857
self.password = password or environment.get("TWILIO_AUTH_TOKEN")
5958
""" :type : str """
60-
if edge is not None:
59+
if (edge is not None and region is None) or (region is not None and edge is None):
6160
warnings.warn(
62-
"`edge` is deprecated and will be removed in a future version. Use `region` instead.",
63-
DeprecationWarning
61+
"For regional processing, DNS is of format product.<edge>.<region>.twilio.com; otherwise use product.twilio.com.",
62+
DeprecationWarning,
63+
stacklevel=2
6464
)
65-
self.edge = (self.region_mappings[region] if region is not None else "") or edge or environment.get("TWILIO_EDGE")
65+
self.edge = edge or environment.get("TWILIO_EDGE") or (self.region_mappings[region] if region is not None else "")
6666
""" :type : str """
6767
self.region = region or environment.get("TWILIO_REGION")
6868
""" :type : str """

0 commit comments

Comments
 (0)