Skip to content

Commit 7963f57

Browse files
authored
Merge pull request #17 from messagemedia/Mapi-253-Basic-Auth-Failure-PythonSdk
Mapi 253 basic auth failure python sdk
2 parents 0e753e4 + 5edfa99 commit 7963f57

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

examples/sendMessage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@
3737
except SendMessages400ResponseException as e:
3838
print(e)
3939
except APIException as e:
40-
print(e)
40+
print(e)

message_media_messages/configuration.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ class Configuration(object):
2424

2525
# The username to use with basic authentication
2626
# TODO: Set an appropriate value
27-
basic_auth_user_name = 'TODO: Replace'
27+
basic_auth_user_name = None
2828

2929
# The password to use with basic authentication
3030
# TODO: Set an appropriate value
31-
basic_auth_password = 'TODO: Replace'
31+
basic_auth_password = None
3232

3333
# The username to use with HMAC authentication
3434
# TODO: Set an appropriate value
35-
hmac_auth_user_name = 'TODO: Replace'
35+
hmac_auth_user_name = None
3636

3737
# The password to use with HMAC authentication
3838
# TODO: Set an appropriate value
39-
hmac_auth_password = 'TODO: Replace'
39+
hmac_auth_password = None
4040

message_media_messages/http/auth/auth_manager.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def apply(http_request, url, body=None):
3030
"""
3131

3232
if Configuration.hmac_auth_user_name is not None and \
33-
Configuration.hmac_auth_password is not None:
33+
Configuration.hmac_auth_password is not None:
3434
AuthManager.apply_hmac_auth(http_request, url, body)
3535
else:
3636
AuthManager.apply_basic_auth(http_request)
@@ -91,16 +91,16 @@ def apply_hmac_auth(http_request, url, body=None):
9191
url,
9292
request_type)
9393

94-
joined = 'username="{}", algorithm="hmac-sha1", headers="date {}'\
95-
'request-line", signature="{}"'\
94+
joined = 'username="{}", algorithm="hmac-sha1", headers="date {}' \
95+
'request-line", signature="{}"' \
9696
.format(username, content_header, hmac_signature)
9797

9898
header_value = "hmac {}".format(joined)
9999
http_request.headers["Authorization"] = header_value
100100

101101
@staticmethod
102102
def create_signature(date, content_signature, url, request_type):
103-
signing_string = "date: {}\n{}{} {} HTTP/1.1"\
103+
signing_string = "date: {}\n{}{} {} HTTP/1.1" \
104104
.format(date, content_signature, request_type, url)
105105

106106
hashed = hmac.new(Configuration.hmac_auth_password.encode("utf-8"),

message_media_messages/message_media_messages_client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,3 @@ def __init__(self,
4141
Configuration.basic_auth_user_name = auth_user_name
4242
Configuration.basic_auth_password = auth_password
4343

44-

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setup(
1010
name='messagemedia-messages-sdk',
11-
version='2.1.1',
11+
version='2.1.2',
1212
description='The MessageMedia Messages API provides a number of endpoints for building powerful two-way messaging applications.',
1313
long_description_content_type="text/markdown",
1414
long_description=long_description,

0 commit comments

Comments
 (0)