Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ License:
The MIT License (MIT)
http://opensource.org/licenses/MIT

Copyright (c) 2014 - 2016 APIMATIC Limited
Copyright (c) 2014 - 2020 APIMATIC Limited

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion bandwidth/controllers/base_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class BaseController(object):

def global_headers(self):
return {
'user-agent': 'python-sdk-refs/tags/python6.13.2'
'user-agent': 'python-sdk'
}

def __init__(self, config, call_back=None):
Expand Down
6 changes: 6 additions & 0 deletions bandwidth/http/api_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,15 @@ def __init__(self, http_response,
self.errors = errors

def is_success(self):
""" Returns true if status code is between 200-300

"""
return 200 <= self.status_code < 300

def is_error(self):
""" Returns true if status code is between 400-600

"""
return 400 <= self.status_code < 600

def __repr__(self):
Expand Down
14 changes: 7 additions & 7 deletions bandwidth/messaging/controllers/api_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def list_media(self,
# Prepare query URL
_url_path = '/users/{userId}/media'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'userId': {'value': user_id, 'encode': True}
'userId': {'value': user_id, 'encode': False}
})
_query_builder = self.config.get_base_uri(Server.MESSAGINGDEFAULT)
_query_builder += _url_path
Expand Down Expand Up @@ -115,7 +115,7 @@ def get_media(self,
# Prepare query URL
_url_path = '/users/{userId}/media/{mediaId}'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'userId': {'value': user_id, 'encode': True},
'userId': {'value': user_id, 'encode': False},
'mediaId': {'value': media_id, 'encode': False}
})
_query_builder = self.config.get_base_uri(Server.MESSAGINGDEFAULT)
Expand Down Expand Up @@ -181,8 +181,8 @@ def upload_media(self,
# Prepare query URL
_url_path = '/users/{userId}/media/{mediaId}'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'userId': {'value': user_id, 'encode': True},
'mediaId': {'value': media_id, 'encode': True}
'userId': {'value': user_id, 'encode': False},
'mediaId': {'value': media_id, 'encode': False}
})
_query_builder = self.config.get_base_uri(Server.MESSAGINGDEFAULT)
_query_builder += _url_path
Expand Down Expand Up @@ -251,8 +251,8 @@ def delete_media(self,
# Prepare query URL
_url_path = '/users/{userId}/media/{mediaId}'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'userId': {'value': user_id, 'encode': True},
'mediaId': {'value': media_id, 'encode': True}
'userId': {'value': user_id, 'encode': False},
'mediaId': {'value': media_id, 'encode': False}
})
_query_builder = self.config.get_base_uri(Server.MESSAGINGDEFAULT)
_query_builder += _url_path
Expand Down Expand Up @@ -308,7 +308,7 @@ def create_message(self,
# Prepare query URL
_url_path = '/users/{userId}/messages'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'userId': {'value': user_id, 'encode': True}
'userId': {'value': user_id, 'encode': False}
})
_query_builder = self.config.get_base_uri(Server.MESSAGINGDEFAULT)
_query_builder += _url_path
Expand Down
2 changes: 1 addition & 1 deletion bandwidth/messaging/controllers/base_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class BaseController(object):

def global_headers(self):
return {
'user-agent': 'python-sdk-refs/tags/python6.13.2'
'user-agent': 'python-sdk'
}

def __init__(self, config, call_back=None):
Expand Down
6 changes: 3 additions & 3 deletions bandwidth/twofactorauth/controllers/api_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def create_voice_two_factor(self,
# Prepare query URL
_url_path = '/accounts/{accountId}/code/voice'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'accountId': {'value': account_id, 'encode': True}
'accountId': {'value': account_id, 'encode': False}
})
_query_builder = self.config.get_base_uri(Server.TWOFACTORAUTHDEFAULT)
_query_builder += _url_path
Expand Down Expand Up @@ -106,7 +106,7 @@ def create_messaging_two_factor(self,
# Prepare query URL
_url_path = '/accounts/{accountId}/code/messaging'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'accountId': {'value': account_id, 'encode': True}
'accountId': {'value': account_id, 'encode': False}
})
_query_builder = self.config.get_base_uri(Server.TWOFACTORAUTHDEFAULT)
_query_builder += _url_path
Expand Down Expand Up @@ -159,7 +159,7 @@ def create_verify_two_factor(self,
# Prepare query URL
_url_path = '/accounts/{accountId}/code/verify'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {
'accountId': {'value': account_id, 'encode': True}
'accountId': {'value': account_id, 'encode': False}
})
_query_builder = self.config.get_base_uri(Server.TWOFACTORAUTHDEFAULT)
_query_builder += _url_path
Expand Down
2 changes: 1 addition & 1 deletion bandwidth/twofactorauth/controllers/base_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class BaseController(object):

def global_headers(self):
return {
'user-agent': 'python-sdk-refs/tags/python6.13.2'
'user-agent': 'python-sdk'
}

def __init__(self, config, call_back=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,10 @@ class TwoFactorVerifyRequestSchema(object):

Attributes:
to (string): The phone number to send the 2fa code to.
mfrom (string): The application phone number, the sender of the 2fa
code.
application_id (string): The application unique ID, obtained from
Bandwidth.
scope (string): An optional field to denote what scope or action the
2fa code is addressing. If not supplied, defaults to "2FA".
digits (float): The number of digits for your 2fa code. The valid
number ranges from 2 to 8, inclusively.
expiration_time_in_minutes (float): The time period, in minutes, to
validate the 2fa code. By setting this to 3 minutes, it will mean
any code generated within the last 3 minutes are still valid. The
Expand All @@ -35,30 +31,24 @@ class TwoFactorVerifyRequestSchema(object):
# Create a mapping from Model property names to API property names
_names = {
"to": 'to',
"mfrom": 'from',
"application_id": 'applicationId',
"digits": 'digits',
"expiration_time_in_minutes": 'expirationTimeInMinutes',
"code": 'code',
"scope": 'scope'
}

def __init__(self,
to=None,
mfrom=None,
application_id=None,
digits=None,
expiration_time_in_minutes=None,
code=None,
scope=None):
"""Constructor for the TwoFactorVerifyRequestSchema class"""

# Initialize members of the class
self.to = to
self.mfrom = mfrom
self.application_id = application_id
self.scope = scope
self.digits = digits
self.expiration_time_in_minutes = expiration_time_in_minutes
self.code = code

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

# Extract variables from the dictionary
to = dictionary.get('to')
mfrom = dictionary.get('from')
application_id = dictionary.get('applicationId')
digits = dictionary.get('digits')
expiration_time_in_minutes = dictionary.get('expirationTimeInMinutes')
code = dictionary.get('code')
scope = dictionary.get('scope')

# Return an object of this model
return cls(to,
mfrom,
application_id,
digits,
expiration_time_in_minutes,
code,
scope)
4 changes: 2 additions & 2 deletions bandwidth/voice/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
__all__ = [
__all__ = [
'bxml',
'controllers',
'exceptions',
'models',
'voice_client',
'voice_client',
]
Loading