(message_body: str, slack_url: str)
| 11 | |
| 12 | |
| 13 | def 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 | |
| 26 | if __name__ == "__main__": |