Skip to content

Commit dd1be4b

Browse files
authored
Fixed JSON encoding for Web API request params (#293)
* Fixed JSON encoding * Updated comments for clarity
1 parent 1a27b1f commit dd1be4b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

slackclient/slackrequest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ def do(self, token, request="?", post_data=None, domain="slack.com", timeout=Non
8888
if isinstance(post_data[field], list):
8989
post_data[field] = ",".join(post_data[field])
9090

91-
# Convert any params which aren't integer, string or bool to JSON
92-
# Example: `attachments` is a dict
91+
# Convert any params which are list-like to JSON strings
92+
# Example: `attachments` is a dict, and needs to be passed as JSON
9393
for k, v in six.iteritems(post_data):
94-
if not isinstance(v, (six.string_types, six.integer_types, bool)):
94+
if isinstance(v, (list, dict)):
9595
post_data[k] = json.dumps(v)
9696

9797
# Submit the request

0 commit comments

Comments
 (0)