Skip to content

Commit 7e97e04

Browse files
authored
Merge pull request #9 from Bandwidth/release/2021-01-08-15-17-38
update mfa schema, disabled media url encoding
2 parents a6ecf14 + b133706 commit 7e97e04

File tree

18 files changed

+219
-114
lines changed

18 files changed

+219
-114
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ License:
33
The MIT License (MIT)
44
http://opensource.org/licenses/MIT
55

6-
Copyright (c) 2014 - 2016 APIMATIC Limited
6+
Copyright (c) 2014 - 2020 APIMATIC Limited
77

88
Permission is hereby granted, free of charge, to any person obtaining a copy
99
of this software and associated documentation files (the "Software"), to deal

bandwidth/controllers/base_controller.py

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

2929
def global_headers(self):
3030
return {
31-
'user-agent': 'python-sdk-refs/tags/python6.13.2'
31+
'user-agent': 'python-sdk'
3232
}
3333

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

bandwidth/http/api_response.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,15 @@ def __init__(self, http_response,
4040
self.errors = errors
4141

4242
def is_success(self):
43+
""" Returns true if status code is between 200-300
44+
45+
"""
4346
return 200 <= self.status_code < 300
4447

4548
def is_error(self):
49+
""" Returns true if status code is between 400-600
50+
51+
"""
4652
return 400 <= self.status_code < 600
4753

4854
def __repr__(self):

bandwidth/messaging/controllers/api_controller.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def list_media(self,
5252
# Prepare query URL
5353
_url_path = '/users/{userId}/media'
5454
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
55-
'userId': {'value': user_id, 'encode': True}
55+
'userId': {'value': user_id, 'encode': False}
5656
})
5757
_query_builder = self.config.get_base_uri(Server.MESSAGINGDEFAULT)
5858
_query_builder += _url_path
@@ -115,7 +115,7 @@ def get_media(self,
115115
# Prepare query URL
116116
_url_path = '/users/{userId}/media/{mediaId}'
117117
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
118-
'userId': {'value': user_id, 'encode': True},
118+
'userId': {'value': user_id, 'encode': False},
119119
'mediaId': {'value': media_id, 'encode': False}
120120
})
121121
_query_builder = self.config.get_base_uri(Server.MESSAGINGDEFAULT)
@@ -181,8 +181,8 @@ def upload_media(self,
181181
# Prepare query URL
182182
_url_path = '/users/{userId}/media/{mediaId}'
183183
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
184-
'userId': {'value': user_id, 'encode': True},
185-
'mediaId': {'value': media_id, 'encode': True}
184+
'userId': {'value': user_id, 'encode': False},
185+
'mediaId': {'value': media_id, 'encode': False}
186186
})
187187
_query_builder = self.config.get_base_uri(Server.MESSAGINGDEFAULT)
188188
_query_builder += _url_path
@@ -251,8 +251,8 @@ def delete_media(self,
251251
# Prepare query URL
252252
_url_path = '/users/{userId}/media/{mediaId}'
253253
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
254-
'userId': {'value': user_id, 'encode': True},
255-
'mediaId': {'value': media_id, 'encode': True}
254+
'userId': {'value': user_id, 'encode': False},
255+
'mediaId': {'value': media_id, 'encode': False}
256256
})
257257
_query_builder = self.config.get_base_uri(Server.MESSAGINGDEFAULT)
258258
_query_builder += _url_path
@@ -308,7 +308,7 @@ def create_message(self,
308308
# Prepare query URL
309309
_url_path = '/users/{userId}/messages'
310310
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
311-
'userId': {'value': user_id, 'encode': True}
311+
'userId': {'value': user_id, 'encode': False}
312312
})
313313
_query_builder = self.config.get_base_uri(Server.MESSAGINGDEFAULT)
314314
_query_builder += _url_path

bandwidth/messaging/controllers/base_controller.py

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

2929
def global_headers(self):
3030
return {
31-
'user-agent': 'python-sdk-refs/tags/python6.13.2'
31+
'user-agent': 'python-sdk'
3232
}
3333

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

bandwidth/twofactorauth/controllers/api_controller.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def create_voice_two_factor(self,
5252
# Prepare query URL
5353
_url_path = '/accounts/{accountId}/code/voice'
5454
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
55-
'accountId': {'value': account_id, 'encode': True}
55+
'accountId': {'value': account_id, 'encode': False}
5656
})
5757
_query_builder = self.config.get_base_uri(Server.TWOFACTORAUTHDEFAULT)
5858
_query_builder += _url_path
@@ -106,7 +106,7 @@ def create_messaging_two_factor(self,
106106
# Prepare query URL
107107
_url_path = '/accounts/{accountId}/code/messaging'
108108
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
109-
'accountId': {'value': account_id, 'encode': True}
109+
'accountId': {'value': account_id, 'encode': False}
110110
})
111111
_query_builder = self.config.get_base_uri(Server.TWOFACTORAUTHDEFAULT)
112112
_query_builder += _url_path
@@ -159,7 +159,7 @@ def create_verify_two_factor(self,
159159
# Prepare query URL
160160
_url_path = '/accounts/{accountId}/code/verify'
161161
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
162-
'accountId': {'value': account_id, 'encode': True}
162+
'accountId': {'value': account_id, 'encode': False}
163163
})
164164
_query_builder = self.config.get_base_uri(Server.TWOFACTORAUTHDEFAULT)
165165
_query_builder += _url_path

bandwidth/twofactorauth/controllers/base_controller.py

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

2929
def global_headers(self):
3030
return {
31-
'user-agent': 'python-sdk-refs/tags/python6.13.2'
31+
'user-agent': 'python-sdk'
3232
}
3333

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

bandwidth/twofactorauth/models/two_factor_verify_request_schema.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,10 @@ class TwoFactorVerifyRequestSchema(object):
1515
1616
Attributes:
1717
to (string): The phone number to send the 2fa code to.
18-
mfrom (string): The application phone number, the sender of the 2fa
19-
code.
2018
application_id (string): The application unique ID, obtained from
2119
Bandwidth.
2220
scope (string): An optional field to denote what scope or action the
2321
2fa code is addressing. If not supplied, defaults to "2FA".
24-
digits (float): The number of digits for your 2fa code. The valid
25-
number ranges from 2 to 8, inclusively.
2622
expiration_time_in_minutes (float): The time period, in minutes, to
2723
validate the 2fa code. By setting this to 3 minutes, it will mean
2824
any code generated within the last 3 minutes are still valid. The
@@ -35,30 +31,24 @@ class TwoFactorVerifyRequestSchema(object):
3531
# Create a mapping from Model property names to API property names
3632
_names = {
3733
"to": 'to',
38-
"mfrom": 'from',
3934
"application_id": 'applicationId',
40-
"digits": 'digits',
4135
"expiration_time_in_minutes": 'expirationTimeInMinutes',
4236
"code": 'code',
4337
"scope": 'scope'
4438
}
4539

4640
def __init__(self,
4741
to=None,
48-
mfrom=None,
4942
application_id=None,
50-
digits=None,
5143
expiration_time_in_minutes=None,
5244
code=None,
5345
scope=None):
5446
"""Constructor for the TwoFactorVerifyRequestSchema class"""
5547

5648
# Initialize members of the class
5749
self.to = to
58-
self.mfrom = mfrom
5950
self.application_id = application_id
6051
self.scope = scope
61-
self.digits = digits
6252
self.expiration_time_in_minutes = expiration_time_in_minutes
6353
self.code = code
6454

@@ -81,18 +71,14 @@ def from_dictionary(cls,
8171

8272
# Extract variables from the dictionary
8373
to = dictionary.get('to')
84-
mfrom = dictionary.get('from')
8574
application_id = dictionary.get('applicationId')
86-
digits = dictionary.get('digits')
8775
expiration_time_in_minutes = dictionary.get('expirationTimeInMinutes')
8876
code = dictionary.get('code')
8977
scope = dictionary.get('scope')
9078

9179
# Return an object of this model
9280
return cls(to,
93-
mfrom,
9481
application_id,
95-
digits,
9682
expiration_time_in_minutes,
9783
code,
9884
scope)

bandwidth/voice/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
__all__ = [
1+
__all__ = [
22
'bxml',
33
'controllers',
44
'exceptions',
55
'models',
6-
'voice_client',
6+
'voice_client',
77
]

0 commit comments

Comments
 (0)