-
Notifications
You must be signed in to change notification settings - Fork 853
Closed
Labels
Version: 3xbugM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documentedM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documentedweb-client
Milestone
Description
Both WebClient and AsyncWebClient accept a sequence of blocks (and attachments) but _parse_web_class_objects fails to serialize the objects into dictionaries since it only checks for lists via isinstance(blocks, list), therefore disagreeing with the clients' signature.
Impact on:
- both sync and async clients
chat_postEphemeral,chat_postMessage,chat_scheduleMessage,chat_unfurl,chat_update- both
BlockandAttachment
Reproducible in:
The Slack SDK version
slack-sdk=3.18.1
Python runtime version
Python 3.10.3
OS info
ProductName: macOS
ProductVersion: 12.5.1
BuildVersion: 21G83
Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:23 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T6000
Steps to reproduce:
client = WebClient(token="token")
# a tuple of blocks
blocks: Sequence[Block] = (
SectionBlock(text="foo"),
SectionBlock(text="bar"),
)
# works
client.chat_postMessage(channel="#channel", blocks=list(blocks))
# raises: Object of type SectionBlock is not JSON serializable
client.chat_postMessage(channel="#channel", blocks=blocks)Expected result:
Since both clients accept a Sequence, one should be able to pass both a list or a tuple.
Actual result:
TypeError: Object of type SectionBlock is not JSON serializable since the blocks weren't serialized into dicts.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Version: 3xbugM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documentedM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documentedweb-client