New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make WebhookClient (sync/async) #send method accept link unfurl params #1047
Changes from 8 commits
e65f9b6
da827cd
dae98dd
75efbee
4782359
5ad43b9
80f61c1
12f07c6
52c44f8
326ca99
9d32daa
ac4f8a4
d8389f4
da13780
693b27b
784bee9
4d5d95b
d410e8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -227,9 +227,9 @@ def _next_cursor_is_present(data) -> bool: | |
return present | ||
|
||
|
||
def _to_0_or_1_if_bool(v: Any) -> Union[Any, str]: | ||
def _to_0_or_1_if_bool(v: Any) -> Union[Any, int]: | ||
if isinstance(v, bool): | ||
return "1" if v else "0" | ||
return 1 if v else 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably, this change is fine for WebClient etc. but I will check the behavior later. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As diff --git a/slack_sdk/webhook/internal_utils.py b/slack_sdk/webhook/internal_utils.py
index 37def28..091c06c 100644
--- a/slack_sdk/webhook/internal_utils.py
+++ b/slack_sdk/webhook/internal_utils.py
@@ -12,7 +12,6 @@ from .webhook_response import WebhookResponse
def _build_body(original_body: Optional[Dict[str, Any]]) -> Optional[Dict[str, Any]]:
if original_body:
body = {k: v for k, v in original_body.items() if v is not None}
- body = convert_bool_to_0_or_1(body)
_parse_web_class_objects(body)
return body
return None There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @seratch. Okay, I see that changing it this way reduces the number of possible affected surfaces. Thanks! I have also reverted the above line to return strings instead of integers. Feel free to resolve this, if these changes are what you had intended! |
||
return v | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For review: I needed the functionality of pulling channel ID in the two new tests. As this would be repeated code, I have pulled the logic into separate function and use in the
test_webhook
,test_with_unfurls_off
andtest_with_unfurls_on
methods where needed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do the same in the
setUp
method and useself.channel_id
in test methods. If you usetoken
/client
in test methods, setting them to the instance fields would be also fine.