Skip to content

Commit 298e53f

Browse files
DX-2088 voice and MFA class and method renames, messaging upload media removal of content length (breaking changes) (#25)
* New deploy * updated tests * bumped version * fixed import * lxml added to requirements * moar fixes * bxml import fix Co-authored-by: jmulford-bw <[email protected]>
1 parent d54facd commit 298e53f

File tree

113 files changed

+1917
-1944
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+1917
-1944
lines changed

bandwidth/api_helper.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"""
44
bandwidth
55
6-
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
6+
This file was automatically generated by APIMATIC v3.0 (
7+
https://www.apimatic.io ).
78
"""
89

910
import re
@@ -78,7 +79,7 @@ def json_serialize(obj):
7879
return jsonpickle.encode(obj, False)
7980

8081
@staticmethod
81-
def json_deserialize(json, unboxing_function=None):
82+
def json_deserialize(json, unboxing_function=None, as_dict=False):
8283
"""JSON Deserialization of a given string.
8384
8485
Args:
@@ -99,6 +100,9 @@ def json_deserialize(json, unboxing_function=None):
99100

100101
if unboxing_function is None:
101102
return decoded
103+
104+
if as_dict:
105+
return {k: unboxing_function(v) for k, v in decoded.items()}
102106
elif isinstance(decoded, list):
103107
return [unboxing_function(element) for element in decoded]
104108
else:

bandwidth/bandwidth_client.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
"""
44
bandwidth
55
6-
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
6+
This file was automatically generated by APIMATIC v3.0 (
7+
https://www.apimatic.io ).
78
"""
89

910
from bandwidth.decorators import lazy_property
1011
from bandwidth.configuration import Configuration
1112
from bandwidth.configuration import Environment
1213
from bandwidth.messaging.messaging_client import MessagingClient
13-
from bandwidth.twofactorauth.two_factor_auth_client import TwoFactorAuthClient
14+
from bandwidth.multifactorauth.multi_factor_auth_client import MultiFactorAuthClient
1415
from bandwidth.phonenumberlookup.phone_number_lookup_client import PhoneNumberLookupClient
1516
from bandwidth.voice.voice_client import VoiceClient
1617
from bandwidth.webrtc.web_rtc_client import WebRtcClient
@@ -23,8 +24,8 @@ def messaging_client(self):
2324
return MessagingClient(config=self.config)
2425

2526
@lazy_property
26-
def two_factor_auth_client(self):
27-
return TwoFactorAuthClient(config=self.config)
27+
def multi_factor_auth_client(self):
28+
return MultiFactorAuthClient(config=self.config)
2829

2930
@lazy_property
3031
def phone_number_lookup_client(self):
@@ -38,13 +39,15 @@ def voice_client(self):
3839
def web_rtc_client(self):
3940
return WebRtcClient(config=self.config)
4041

41-
def __init__(self, timeout=60, max_retries=3, backoff_factor=0,
42+
def __init__(self, timeout=60, max_retries=0, backoff_factor=2,
43+
retry_statuses=[408, 413, 429, 500, 502, 503, 504, 521, 522, 524, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
44+
retry_methods=['GET', 'PUT', 'GET', 'PUT'],
4245
environment=Environment.PRODUCTION,
4346
base_url='https://www.example.com',
4447
messaging_basic_auth_user_name='TODO: Replace',
4548
messaging_basic_auth_password='TODO: Replace',
46-
two_factor_auth_basic_auth_user_name='TODO: Replace',
47-
two_factor_auth_basic_auth_password='TODO: Replace',
49+
multi_factor_auth_basic_auth_user_name='TODO: Replace',
50+
multi_factor_auth_basic_auth_password='TODO: Replace',
4851
phone_number_lookup_basic_auth_user_name='TODO: Replace',
4952
phone_number_lookup_basic_auth_password='TODO: Replace',
5053
voice_basic_auth_user_name='TODO: Replace',
@@ -55,12 +58,14 @@ def __init__(self, timeout=60, max_retries=3, backoff_factor=0,
5558
self.config = Configuration(timeout=timeout,
5659
max_retries=max_retries,
5760
backoff_factor=backoff_factor,
61+
retry_statuses=retry_statuses,
62+
retry_methods=retry_methods,
5863
environment=environment,
5964
base_url=base_url,
6065
messaging_basic_auth_user_name=messaging_basic_auth_user_name,
6166
messaging_basic_auth_password=messaging_basic_auth_password,
62-
two_factor_auth_basic_auth_user_name=two_factor_auth_basic_auth_user_name,
63-
two_factor_auth_basic_auth_password=two_factor_auth_basic_auth_password,
67+
multi_factor_auth_basic_auth_user_name=multi_factor_auth_basic_auth_user_name,
68+
multi_factor_auth_basic_auth_password=multi_factor_auth_basic_auth_password,
6469
phone_number_lookup_basic_auth_user_name=phone_number_lookup_basic_auth_user_name,
6570
phone_number_lookup_basic_auth_password=phone_number_lookup_basic_auth_password,
6671
voice_basic_auth_user_name=voice_basic_auth_user_name,

bandwidth/configuration.py

Lines changed: 50 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"""
44
bandwidth
55
6-
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
6+
This file was automatically generated by APIMATIC v3.0 (
7+
https://www.apimatic.io ).
78
"""
89

910
from enum import Enum
@@ -21,7 +22,7 @@ class Server(Enum):
2122
"""An enum for API servers"""
2223
DEFAULT = 0
2324
MESSAGINGDEFAULT = 1
24-
TWOFACTORAUTHDEFAULT = 2
25+
MULTIFACTORAUTHDEFAULT = 2
2526
PHONENUMBERLOOKUPDEFAULT = 3
2627
VOICEDEFAULT = 4
2728
WEBRTCDEFAULT = 5
@@ -47,6 +48,14 @@ def max_retries(self):
4748
def backoff_factor(self):
4849
return self._backoff_factor
4950

51+
@property
52+
def retry_statuses(self):
53+
return self._retry_statuses
54+
55+
@property
56+
def retry_methods(self):
57+
return self._retry_methods
58+
5059
@property
5160
def environment(self):
5261
return self._environment
@@ -64,12 +73,12 @@ def messaging_basic_auth_password(self):
6473
return self._messaging_basic_auth_password
6574

6675
@property
67-
def two_factor_auth_basic_auth_user_name(self):
68-
return self._two_factor_auth_basic_auth_user_name
76+
def multi_factor_auth_basic_auth_user_name(self):
77+
return self._multi_factor_auth_basic_auth_user_name
6978

7079
@property
71-
def two_factor_auth_basic_auth_password(self):
72-
return self._two_factor_auth_basic_auth_password
80+
def multi_factor_auth_basic_auth_password(self):
81+
return self._multi_factor_auth_basic_auth_password
7382

7483
@property
7584
def phone_number_lookup_basic_auth_user_name(self):
@@ -95,19 +104,16 @@ def web_rtc_basic_auth_user_name(self):
95104
def web_rtc_basic_auth_password(self):
96105
return self._web_rtc_basic_auth_password
97106

98-
def __init__(self, timeout=60, max_retries=3, backoff_factor=0,
99-
environment=Environment.PRODUCTION,
100-
base_url='https://www.example.com',
101-
messaging_basic_auth_user_name='TODO: Replace',
102-
messaging_basic_auth_password='TODO: Replace',
103-
two_factor_auth_basic_auth_user_name='TODO: Replace',
104-
two_factor_auth_basic_auth_password='TODO: Replace',
105-
phone_number_lookup_basic_auth_user_name='TODO: Replace',
106-
phone_number_lookup_basic_auth_password='TODO: Replace',
107-
voice_basic_auth_user_name='TODO: Replace',
108-
voice_basic_auth_password='TODO: Replace',
109-
web_rtc_basic_auth_user_name='TODO: Replace',
110-
web_rtc_basic_auth_password='TODO: Replace'):
107+
def __init__(
108+
self, timeout=60, max_retries=0, backoff_factor=2,
109+
retry_statuses=[408, 413, 429, 500, 502, 503, 504, 521, 522, 524, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
110+
retry_methods=['GET', 'PUT', 'GET', 'PUT'], environment=Environment.PRODUCTION, base_url='https://www.example.com',
111+
messaging_basic_auth_user_name='TODO: Replace', messaging_basic_auth_password='TODO: Replace',
112+
multi_factor_auth_basic_auth_user_name='TODO: Replace', multi_factor_auth_basic_auth_password='TODO: Replace',
113+
phone_number_lookup_basic_auth_user_name='TODO: Replace', phone_number_lookup_basic_auth_password='TODO: Replace',
114+
voice_basic_auth_user_name='TODO: Replace', voice_basic_auth_password='TODO: Replace',
115+
web_rtc_basic_auth_user_name='TODO: Replace', web_rtc_basic_auth_password='TODO: Replace'
116+
):
111117
# The value to use for connection timeout
112118
self._timeout = timeout
113119

@@ -119,6 +125,12 @@ def __init__(self, timeout=60, max_retries=3, backoff_factor=0,
119125
# `{backoff factor} * (2 ** ({number of total retries} - 1))`
120126
self._backoff_factor = backoff_factor
121127

128+
# The http statuses on which retry is to be done
129+
self._retry_statuses = retry_statuses
130+
131+
# The http methods on which retry is to be done
132+
self._retry_methods = retry_methods
133+
122134
# Current API environment
123135
self._environment = environment
124136

@@ -132,10 +144,10 @@ def __init__(self, timeout=60, max_retries=3, backoff_factor=0,
132144
self._messaging_basic_auth_password = messaging_basic_auth_password
133145

134146
# The username to use with basic authentication
135-
self._two_factor_auth_basic_auth_user_name = two_factor_auth_basic_auth_user_name
147+
self._multi_factor_auth_basic_auth_user_name = multi_factor_auth_basic_auth_user_name
136148

137149
# The password to use with basic authentication
138-
self._two_factor_auth_basic_auth_password = two_factor_auth_basic_auth_password
150+
self._multi_factor_auth_basic_auth_password = multi_factor_auth_basic_auth_password
139151

140152
# The username to use with basic authentication
141153
self._phone_number_lookup_basic_auth_user_name = phone_number_lookup_basic_auth_user_name
@@ -159,11 +171,11 @@ def __init__(self, timeout=60, max_retries=3, backoff_factor=0,
159171
self._http_client = self.create_http_client()
160172

161173
def clone_with(self, timeout=None, max_retries=None, backoff_factor=None,
162-
environment=None, base_url=None,
163-
messaging_basic_auth_user_name=None,
174+
retry_statuses=None, retry_methods=None, environment=None,
175+
base_url=None, messaging_basic_auth_user_name=None,
164176
messaging_basic_auth_password=None,
165-
two_factor_auth_basic_auth_user_name=None,
166-
two_factor_auth_basic_auth_password=None,
177+
multi_factor_auth_basic_auth_user_name=None,
178+
multi_factor_auth_basic_auth_password=None,
167179
phone_number_lookup_basic_auth_user_name=None,
168180
phone_number_lookup_basic_auth_password=None,
169181
voice_basic_auth_user_name=None,
@@ -173,12 +185,14 @@ def clone_with(self, timeout=None, max_retries=None, backoff_factor=None,
173185
timeout = timeout or self.timeout
174186
max_retries = max_retries or self.max_retries
175187
backoff_factor = backoff_factor or self.backoff_factor
188+
retry_statuses = retry_statuses or self.retry_statuses
189+
retry_methods = retry_methods or self.retry_methods
176190
environment = environment or self.environment
177191
base_url = base_url or self.base_url
178192
messaging_basic_auth_user_name = messaging_basic_auth_user_name or self.messaging_basic_auth_user_name
179193
messaging_basic_auth_password = messaging_basic_auth_password or self.messaging_basic_auth_password
180-
two_factor_auth_basic_auth_user_name = two_factor_auth_basic_auth_user_name or self.two_factor_auth_basic_auth_user_name
181-
two_factor_auth_basic_auth_password = two_factor_auth_basic_auth_password or self.two_factor_auth_basic_auth_password
194+
multi_factor_auth_basic_auth_user_name = multi_factor_auth_basic_auth_user_name or self.multi_factor_auth_basic_auth_user_name
195+
multi_factor_auth_basic_auth_password = multi_factor_auth_basic_auth_password or self.multi_factor_auth_basic_auth_password
182196
phone_number_lookup_basic_auth_user_name = phone_number_lookup_basic_auth_user_name or self.phone_number_lookup_basic_auth_user_name
183197
phone_number_lookup_basic_auth_password = phone_number_lookup_basic_auth_password or self.phone_number_lookup_basic_auth_password
184198
voice_basic_auth_user_name = voice_basic_auth_user_name or self.voice_basic_auth_user_name
@@ -188,11 +202,12 @@ def clone_with(self, timeout=None, max_retries=None, backoff_factor=None,
188202

189203
return Configuration(
190204
timeout=timeout, max_retries=max_retries,
191-
backoff_factor=backoff_factor, environment=environment, base_url=base_url,
205+
backoff_factor=backoff_factor, retry_statuses=retry_statuses,
206+
retry_methods=retry_methods, environment=environment, base_url=base_url,
192207
messaging_basic_auth_user_name=messaging_basic_auth_user_name,
193208
messaging_basic_auth_password=messaging_basic_auth_password,
194-
two_factor_auth_basic_auth_user_name=two_factor_auth_basic_auth_user_name,
195-
two_factor_auth_basic_auth_password=two_factor_auth_basic_auth_password,
209+
multi_factor_auth_basic_auth_user_name=multi_factor_auth_basic_auth_user_name,
210+
multi_factor_auth_basic_auth_password=multi_factor_auth_basic_auth_password,
196211
phone_number_lookup_basic_auth_user_name=phone_number_lookup_basic_auth_user_name,
197212
phone_number_lookup_basic_auth_password=phone_number_lookup_basic_auth_password,
198213
voice_basic_auth_user_name=voice_basic_auth_user_name,
@@ -204,22 +219,24 @@ def clone_with(self, timeout=None, max_retries=None, backoff_factor=None,
204219
def create_http_client(self):
205220
return RequestsClient(timeout=self.timeout,
206221
max_retries=self.max_retries,
207-
backoff_factor=self.backoff_factor)
222+
backoff_factor=self.backoff_factor,
223+
retry_statuses=self.retry_statuses,
224+
retry_methods=self.retry_methods)
208225

209226
# All the environments the SDK can run in
210227
environments = {
211228
Environment.PRODUCTION: {
212229
Server.DEFAULT: 'api.bandwidth.com',
213230
Server.MESSAGINGDEFAULT: 'https://messaging.bandwidth.com/api/v2',
214-
Server.TWOFACTORAUTHDEFAULT: 'https://mfa.bandwidth.com/api/v1',
231+
Server.MULTIFACTORAUTHDEFAULT: 'https://mfa.bandwidth.com/api/v1',
215232
Server.PHONENUMBERLOOKUPDEFAULT: 'https://numbers.bandwidth.com/api/v1',
216233
Server.VOICEDEFAULT: 'https://voice.bandwidth.com',
217234
Server.WEBRTCDEFAULT: 'https://api.webrtc.bandwidth.com/v1'
218235
},
219236
Environment.CUSTOM: {
220237
Server.DEFAULT: '{base_url}',
221238
Server.MESSAGINGDEFAULT: '{base_url}',
222-
Server.TWOFACTORAUTHDEFAULT: '{base_url}',
239+
Server.MULTIFACTORAUTHDEFAULT: '{base_url}',
223240
Server.PHONENUMBERLOOKUPDEFAULT: '{base_url}',
224241
Server.VOICEDEFAULT: '{base_url}',
225242
Server.WEBRTCDEFAULT: '{base_url}'

bandwidth/controllers/base_controller.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"""
44
bandwidth
55
6-
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
6+
This file was automatically generated by APIMATIC v3.0 (
7+
https://www.apimatic.io ).
78
"""
89

910
from bandwidth.api_helper import APIHelper

bandwidth/decorators.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"""
44
bandwidth
55
6-
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
6+
This file was automatically generated by APIMATIC v3.0 (
7+
https://www.apimatic.io ).
78
"""
89

910

bandwidth/exceptions/api_exception.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"""
44
bandwidth
55
6-
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
6+
This file was automatically generated by APIMATIC v3.0 (
7+
https://www.apimatic.io ).
78
"""
89

910

bandwidth/http/auth/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
__all__ = [
22
'messaging_basic_auth',
3-
'two_factor_auth_basic_auth',
3+
'multi_factor_auth_basic_auth',
4+
'phone_number_lookup_basic_auth',
45
'voice_basic_auth',
56
'web_rtc_basic_auth',
67
]

bandwidth/http/auth/messaging_basic_auth.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"""
44
bandwidth
55
6-
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
6+
This file was automatically generated by APIMATIC v3.0 (
7+
https://www.apimatic.io ).
78
"""
89

910
import base64

bandwidth/http/auth/two_factor_auth_basic_auth.py renamed to bandwidth/http/auth/multi_factor_auth_basic_auth.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
"""
44
bandwidth
55
6-
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
6+
This file was automatically generated by APIMATIC v3.0 (
7+
https://www.apimatic.io ).
78
"""
89

910
import base64
1011

1112

12-
class TwoFactorAuthBasicAuth:
13+
class MultiFactorAuthBasicAuth:
1314

1415
@staticmethod
1516
def apply(config, http_request):
@@ -22,8 +23,8 @@ def apply(config, http_request):
2223
authentication will be added.
2324
2425
"""
25-
username = config.two_factor_auth_basic_auth_user_name
26-
password = config.two_factor_auth_basic_auth_password
26+
username = config.multi_factor_auth_basic_auth_user_name
27+
password = config.multi_factor_auth_basic_auth_password
2728
joined = "{}:{}".format(username, password)
2829
encoded = base64.b64encode(str.encode(joined)).decode('iso-8859-1')
2930
header_value = "Basic {}".format(encoded)

0 commit comments

Comments
 (0)