Skip to content

Commit fc8ddf6

Browse files
committed
Deploy
1 parent 94d65dd commit fc8ddf6

39 files changed

+1680
-91
lines changed

bandwidth/bandwidth_client.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from bandwidth.messaging.messaging_client import MessagingClient
1313
from bandwidth.twofactorauth.two_factor_auth_client import TwoFactorAuthClient
1414
from bandwidth.voice.voice_client import VoiceClient
15+
from bandwidth.webrtc.web_rtc_client import WebRtcClient
1516

1617

1718
class BandwidthClient(object):
@@ -28,24 +29,34 @@ def two_factor_auth_client(self):
2829
def voice_client(self):
2930
return VoiceClient(config=self.config)
3031

32+
@lazy_property
33+
def web_rtc_client(self):
34+
return WebRtcClient(config=self.config)
35+
3136
def __init__(self, timeout=60, max_retries=3, backoff_factor=0,
3237
environment=Environment.PRODUCTION,
38+
web_rtc_server='https://api.webrtc.bandwidth.com',
3339
messaging_basic_auth_user_name='TODO: Replace',
3440
messaging_basic_auth_password='TODO: Replace',
3541
two_factor_auth_basic_auth_user_name='TODO: Replace',
3642
two_factor_auth_basic_auth_password='TODO: Replace',
3743
voice_basic_auth_user_name='TODO: Replace',
38-
voice_basic_auth_password='TODO: Replace', config=None):
44+
voice_basic_auth_password='TODO: Replace',
45+
web_rtc_basic_auth_user_name='TODO: Replace',
46+
web_rtc_basic_auth_password='TODO: Replace', config=None):
3947
if config is None:
4048
self.config = Configuration(timeout=timeout,
4149
max_retries=max_retries,
4250
backoff_factor=backoff_factor,
4351
environment=environment,
52+
web_rtc_server=web_rtc_server,
4453
messaging_basic_auth_user_name=messaging_basic_auth_user_name,
4554
messaging_basic_auth_password=messaging_basic_auth_password,
4655
two_factor_auth_basic_auth_user_name=two_factor_auth_basic_auth_user_name,
4756
two_factor_auth_basic_auth_password=two_factor_auth_basic_auth_password,
4857
voice_basic_auth_user_name=voice_basic_auth_user_name,
49-
voice_basic_auth_password=voice_basic_auth_password)
58+
voice_basic_auth_password=voice_basic_auth_password,
59+
web_rtc_basic_auth_user_name=web_rtc_basic_auth_user_name,
60+
web_rtc_basic_auth_password=web_rtc_basic_auth_password)
5061
else:
5162
self.config = config

bandwidth/configuration.py

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"""
88

99
from enum import Enum
10+
from bandwidth.api_helper import APIHelper
1011
from 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

2628
class 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+
)

bandwidth/controllers/base_controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class BaseController(object):
2727
"""
2828

2929
global_headers = {
30-
'user-agent': 'python-sdk-refs/tags/python6.3.0'
30+
'user-agent': 'python-sdk-refs/tags/python6.4.0'
3131
}
3232

3333
def __init__(self, config, call_back=None):

bandwidth/http/auth/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
__all__ = [
22
'messaging_basic_auth',
33
'two_factor_auth_basic_auth',
4-
'voice_basic_auth',
4+
'voice_basic_auth',
5+
'web_rtc_basic_auth',
56
]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
bandwidth
5+
6+
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
7+
"""
8+
9+
import base64
10+
11+
12+
class WebRtcBasicAuth:
13+
14+
@staticmethod
15+
def apply(config, http_request):
16+
""" Add basic authentication to the request.
17+
18+
Args:
19+
config (Configuration): The Configuration object which holds the
20+
authentication information.
21+
http_request (HttpRequest): The HttpRequest object to which
22+
authentication will be added.
23+
24+
"""
25+
username = config.web_rtc_basic_auth_user_name
26+
password = config.web_rtc_basic_auth_password
27+
joined = "{}:{}".format(username, password)
28+
encoded = base64.b64encode(str.encode(joined)).decode('iso-8859-1')
29+
header_value = "Basic {}".format(encoded)
30+
http_request.headers["Authorization"] = header_value

bandwidth/messaging/controllers/base_controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class BaseController(object):
2727
"""
2828

2929
global_headers = {
30-
'user-agent': 'python-sdk-refs/tags/python6.3.0'
30+
'user-agent': 'python-sdk-refs/tags/python6.4.0'
3131
}
3232

3333
def __init__(self, config, call_back=None):

bandwidth/messaging/messaging_client.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,28 @@ def client(self):
2020

2121
def __init__(self, timeout=60, max_retries=3, backoff_factor=0,
2222
environment=Environment.PRODUCTION,
23+
web_rtc_server='https://api.webrtc.bandwidth.com',
2324
messaging_basic_auth_user_name='TODO: Replace',
2425
messaging_basic_auth_password='TODO: Replace',
2526
two_factor_auth_basic_auth_user_name='TODO: Replace',
2627
two_factor_auth_basic_auth_password='TODO: Replace',
2728
voice_basic_auth_user_name='TODO: Replace',
28-
voice_basic_auth_password='TODO: Replace', config=None):
29+
voice_basic_auth_password='TODO: Replace',
30+
web_rtc_basic_auth_user_name='TODO: Replace',
31+
web_rtc_basic_auth_password='TODO: Replace', config=None):
2932
if config is None:
3033
self.config = Configuration(timeout=timeout,
3134
max_retries=max_retries,
3235
backoff_factor=backoff_factor,
3336
environment=environment,
37+
web_rtc_server=web_rtc_server,
3438
messaging_basic_auth_user_name=messaging_basic_auth_user_name,
3539
messaging_basic_auth_password=messaging_basic_auth_password,
3640
two_factor_auth_basic_auth_user_name=two_factor_auth_basic_auth_user_name,
3741
two_factor_auth_basic_auth_password=two_factor_auth_basic_auth_password,
3842
voice_basic_auth_user_name=voice_basic_auth_user_name,
39-
voice_basic_auth_password=voice_basic_auth_password)
43+
voice_basic_auth_password=voice_basic_auth_password,
44+
web_rtc_basic_auth_user_name=web_rtc_basic_auth_user_name,
45+
web_rtc_basic_auth_password=web_rtc_basic_auth_password)
4046
else:
4147
self.config = config

bandwidth/twofactorauth/controllers/base_controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class BaseController(object):
2727
"""
2828

2929
global_headers = {
30-
'user-agent': 'python-sdk-refs/tags/python6.3.0'
30+
'user-agent': 'python-sdk-refs/tags/python6.4.0'
3131
}
3232

3333
def __init__(self, config, call_back=None):

bandwidth/twofactorauth/two_factor_auth_client.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,28 @@ def client(self):
2020

2121
def __init__(self, timeout=60, max_retries=3, backoff_factor=0,
2222
environment=Environment.PRODUCTION,
23+
web_rtc_server='https://api.webrtc.bandwidth.com',
2324
messaging_basic_auth_user_name='TODO: Replace',
2425
messaging_basic_auth_password='TODO: Replace',
2526
two_factor_auth_basic_auth_user_name='TODO: Replace',
2627
two_factor_auth_basic_auth_password='TODO: Replace',
2728
voice_basic_auth_user_name='TODO: Replace',
28-
voice_basic_auth_password='TODO: Replace', config=None):
29+
voice_basic_auth_password='TODO: Replace',
30+
web_rtc_basic_auth_user_name='TODO: Replace',
31+
web_rtc_basic_auth_password='TODO: Replace', config=None):
2932
if config is None:
3033
self.config = Configuration(timeout=timeout,
3134
max_retries=max_retries,
3235
backoff_factor=backoff_factor,
3336
environment=environment,
37+
web_rtc_server=web_rtc_server,
3438
messaging_basic_auth_user_name=messaging_basic_auth_user_name,
3539
messaging_basic_auth_password=messaging_basic_auth_password,
3640
two_factor_auth_basic_auth_user_name=two_factor_auth_basic_auth_user_name,
3741
two_factor_auth_basic_auth_password=two_factor_auth_basic_auth_password,
3842
voice_basic_auth_user_name=voice_basic_auth_user_name,
39-
voice_basic_auth_password=voice_basic_auth_password)
43+
voice_basic_auth_password=voice_basic_auth_password,
44+
web_rtc_basic_auth_user_name=web_rtc_basic_auth_user_name,
45+
web_rtc_basic_auth_password=web_rtc_basic_auth_password)
4046
else:
4147
self.config = config

bandwidth/voice/bxml/verbs/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313
from .resume_recording import ResumeRecording
1414
from .stop_recording import StopRecording
1515
from .start_recording import StartRecording
16+
from .conference import Conference

0 commit comments

Comments
 (0)