77"""
88
99from enum import Enum
10+ from bandwidth .api_helper import APIHelper
1011from bandwidth .http .requests_client import RequestsClient
1112
1213
@@ -21,6 +22,7 @@ class Server(Enum):
2122 MESSAGINGDEFAULT = 1
2223 TWOFACTORAUTHDEFAULT = 2
2324 VOICEDEFAULT = 3
25+ WEBRTCDEFAULT = 4
2426
2527
2628class Configuration (object ):
@@ -47,6 +49,10 @@ def backoff_factor(self):
4749 def environment (self ):
4850 return self ._environment
4951
52+ @property
53+ def web_rtc_server (self ):
54+ return self ._web_rtc_server
55+
5056 @property
5157 def messaging_basic_auth_user_name (self ):
5258 return self ._messaging_basic_auth_user_name
@@ -71,14 +77,25 @@ def voice_basic_auth_user_name(self):
7177 def voice_basic_auth_password (self ):
7278 return self ._voice_basic_auth_password
7379
80+ @property
81+ def web_rtc_basic_auth_user_name (self ):
82+ return self ._web_rtc_basic_auth_user_name
83+
84+ @property
85+ def web_rtc_basic_auth_password (self ):
86+ return self ._web_rtc_basic_auth_password
87+
7488 def __init__ (self , timeout = 60 , max_retries = 3 , backoff_factor = 0 ,
7589 environment = Environment .PRODUCTION ,
90+ web_rtc_server = 'https://api.webrtc.bandwidth.com' ,
7691 messaging_basic_auth_user_name = 'TODO: Replace' ,
7792 messaging_basic_auth_password = 'TODO: Replace' ,
7893 two_factor_auth_basic_auth_user_name = 'TODO: Replace' ,
7994 two_factor_auth_basic_auth_password = 'TODO: Replace' ,
8095 voice_basic_auth_user_name = 'TODO: Replace' ,
81- voice_basic_auth_password = 'TODO: Replace' ):
96+ voice_basic_auth_password = 'TODO: Replace' ,
97+ web_rtc_basic_auth_user_name = 'TODO: Replace' ,
98+ web_rtc_basic_auth_password = 'TODO: Replace' ):
8299 # The value to use for connection timeout
83100 self ._timeout = timeout
84101
@@ -93,6 +110,9 @@ def __init__(self, timeout=60, max_retries=3, backoff_factor=0,
93110 # Current API environment
94111 self ._environment = environment
95112
113+ # web_rtc_server value
114+ self ._web_rtc_server = web_rtc_server
115+
96116 # The username to use with basic authentication
97117 self ._messaging_basic_auth_user_name = messaging_basic_auth_user_name
98118
@@ -111,36 +131,51 @@ def __init__(self, timeout=60, max_retries=3, backoff_factor=0,
111131 # The password to use with basic authentication
112132 self ._voice_basic_auth_password = voice_basic_auth_password
113133
134+ # The username to use with basic authentication
135+ self ._web_rtc_basic_auth_user_name = web_rtc_basic_auth_user_name
136+
137+ # The password to use with basic authentication
138+ self ._web_rtc_basic_auth_password = web_rtc_basic_auth_password
139+
114140 # The Http Client to use for making requests.
115141 self ._http_client = self .create_http_client ()
116142
117143 def clone_with (self , timeout = None , max_retries = None , backoff_factor = None ,
118- environment = None , messaging_basic_auth_user_name = None ,
144+ environment = None , web_rtc_server = None ,
145+ messaging_basic_auth_user_name = None ,
119146 messaging_basic_auth_password = None ,
120147 two_factor_auth_basic_auth_user_name = None ,
121148 two_factor_auth_basic_auth_password = None ,
122149 voice_basic_auth_user_name = None ,
123- voice_basic_auth_password = None ):
150+ voice_basic_auth_password = None ,
151+ web_rtc_basic_auth_user_name = None ,
152+ web_rtc_basic_auth_password = None ):
124153 timeout = timeout or self .timeout
125154 max_retries = max_retries or self .max_retries
126155 backoff_factor = backoff_factor or self .backoff_factor
127156 environment = environment or self .environment
157+ web_rtc_server = web_rtc_server or self .web_rtc_server
128158 messaging_basic_auth_user_name = messaging_basic_auth_user_name or self .messaging_basic_auth_user_name
129159 messaging_basic_auth_password = messaging_basic_auth_password or self .messaging_basic_auth_password
130160 two_factor_auth_basic_auth_user_name = two_factor_auth_basic_auth_user_name or self .two_factor_auth_basic_auth_user_name
131161 two_factor_auth_basic_auth_password = two_factor_auth_basic_auth_password or self .two_factor_auth_basic_auth_password
132162 voice_basic_auth_user_name = voice_basic_auth_user_name or self .voice_basic_auth_user_name
133163 voice_basic_auth_password = voice_basic_auth_password or self .voice_basic_auth_password
164+ web_rtc_basic_auth_user_name = web_rtc_basic_auth_user_name or self .web_rtc_basic_auth_user_name
165+ web_rtc_basic_auth_password = web_rtc_basic_auth_password or self .web_rtc_basic_auth_password
134166
135167 return Configuration (
136168 timeout = timeout , max_retries = max_retries ,
137169 backoff_factor = backoff_factor , environment = environment ,
170+ web_rtc_server = web_rtc_server ,
138171 messaging_basic_auth_user_name = messaging_basic_auth_user_name ,
139172 messaging_basic_auth_password = messaging_basic_auth_password ,
140173 two_factor_auth_basic_auth_user_name = two_factor_auth_basic_auth_user_name ,
141174 two_factor_auth_basic_auth_password = two_factor_auth_basic_auth_password ,
142175 voice_basic_auth_user_name = voice_basic_auth_user_name ,
143- voice_basic_auth_password = voice_basic_auth_password
176+ voice_basic_auth_password = voice_basic_auth_password ,
177+ web_rtc_basic_auth_user_name = web_rtc_basic_auth_user_name ,
178+ web_rtc_basic_auth_password = web_rtc_basic_auth_password
144179 )
145180
146181 def create_http_client (self ):
@@ -154,7 +189,8 @@ def create_http_client(self):
154189 Server .DEFAULT : 'api.bandwidth.com' ,
155190 Server .MESSAGINGDEFAULT : 'https://messaging.bandwidth.com/api/v2' ,
156191 Server .TWOFACTORAUTHDEFAULT : 'https://mfa.bandwidth.com/api/v1/' ,
157- Server .VOICEDEFAULT : 'https://voice.bandwidth.com'
192+ Server .VOICEDEFAULT : 'https://voice.bandwidth.com' ,
193+ Server .WEBRTCDEFAULT : '{WebRtcServer}/v1'
158194 }
159195 }
160196
@@ -170,4 +206,10 @@ def get_base_uri(self, server=Server.DEFAULT):
170206 String: The base URI.
171207
172208 """
173- return self .environments [self .environment ][server ]
209+ parameters = {
210+ "WebRtcServer" : self .web_rtc_server ,
211+ }
212+
213+ return APIHelper .append_url_with_template_parameters (
214+ self .environments [self .environment ][server ], parameters , False
215+ )
0 commit comments