Created
December 30, 2020 01:02
-
-
Save vvksh/fbdad20413f9b871de5c84a2a04d76a3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def send_slack(something:str, channel:str) -> int: | |
""" | |
Sends message to slack channel | |
:param something: message | |
:param channel: channel to post | |
:return: response code | |
""" | |
data = { | |
'text': something, | |
'icon_emoji': ':robot_face:', | |
'channel': channel | |
} | |
response: Response = requests.post(os.getenv("WEBHOOK_URL"), | |
data=json.dumps(data), | |
headers={'Content-Type': 'application/json'}) | |
print('Response: ' + str(response.text)) | |
return response.status_code |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment