Skip to content

Commit 0973712

Browse files
committed
Address PR review comments
- receive_verify_post: use isinstance(send_json, dict) guard and .get() instead of direct key access, as suggested by reviewers - sailthru/__init__.py: sync __version__ to 2.3.6 (was stale at 2.3.1) - sailthru/sailthru_http.py: update hardcoded version in User-Agent to 2.3.6 - CHANGES: add 2.3.6 changelog entry
1 parent e97071c commit 0973712

4 files changed

Lines changed: 11 additions & 4 deletions

File tree

CHANGES

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,10 @@
4343
2.3.5
4444
===
4545
- Add request timeout argument
46+
47+
2.3.6
48+
===
49+
- Fix Python 3 bytes/str incompatibility: use response.text instead of response.content so simplejson (required dependency) receives a str
50+
- Fix receive_verify_post to use the dict returned by get_body() directly instead of calling json.loads on it again
51+
- Fix get_signature_string returning bytes instead of str; encoding moved to get_signature_hash where hashlib requires it
52+
- Sync version string across __init__.py, sailthru_http.py User-Agent, and setup.py

sailthru/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
__doc__ = 'Python binding for Sailthru API based on Requests'
77
__copyright__ = 'Copyright 2012-2015, Sailthru Inc.'
88
__license__ = 'MIT'
9-
__version__ = '2.3.1'
9+
__version__ = '2.3.6'

sailthru/sailthru_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,9 +590,9 @@ def receive_verify_post(self, post_params):
590590
send_response = self.get_send(post_params['send_id'])
591591

592592
send_json = send_response.get_body()
593-
if not send_json or 'email' not in send_json:
593+
if not isinstance(send_json, dict):
594594
return False
595-
if send_json['email'] != post_params['email']:
595+
if send_json.get('email') != post_params['email']:
596596
return False
597597

598598
return True

sailthru/sailthru_http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def sailthru_http_request(url, data, method, file_data=None, headers=None, reque
3434
data = flatten_nested_hash(data)
3535
method = method.upper()
3636
params, data = (None, data) if method == 'POST' else (data, None)
37-
sailthru_headers = {'User-Agent': 'Sailthru API Python Client %s; Python Version: %s' % ('2.3.5', platform.python_version())}
37+
sailthru_headers = {'User-Agent': 'Sailthru API Python Client %s; Python Version: %s' % ('2.3.6', platform.python_version())}
3838
if headers and isinstance(headers, dict):
3939
for key, value in sailthru_headers.items():
4040
headers[key] = value

0 commit comments

Comments
 (0)