MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / send_slack_message

Function send_slack_message

web_programming/slack_message.py:13–23  ·  view source on GitHub ↗
(message_body: str, slack_url: str)

Source from the content-addressed store, hash-verified

11
12
13def send_slack_message(message_body: str, slack_url: str) -> None:
14 headers = {"Content-Type": "application/json"}
15 response = httpx.post(
16 slack_url, json={"text": message_body}, headers=headers, timeout=10
17 )
18 if response.status_code != 200:
19 msg = (
20 "Request to slack returned an error "
21 f"{response.status_code}, the response is:\n{response.text}"
22 )
23 raise ValueError(msg)
24
25
26if __name__ == "__main__":

Callers 1

slack_message.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected