Created
December 20, 2020 04:05
-
-
Save amalgjose/4297d9efbe9ca58040a5696d30095421 to your computer and use it in GitHub Desktop.
Sample program to send slack notification using webhook
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
import json | |
import sys | |
import requests | |
URL = "" | |
message = "" | |
def send_notification(url, message): | |
title = (f"DMP Notification :zap:") | |
slack_data = { | |
"username": "NotificationBot", | |
"icon_emoji": ":satellite:", | |
#"channel" : "#somerandomcahnnel", | |
"attachments": [ | |
{ | |
"color": "#9733EE", | |
"fields": [ | |
{ | |
"title": title, | |
"value": message, | |
"short": "false", | |
} | |
] | |
} | |
] | |
} | |
byte_length = str(sys.getsizeof(slack_data)) | |
headers = {'Content-Type': "application/json", 'Content-Length': byte_length} | |
response = requests.post(url, data=json.dumps(slack_data), headers=headers) | |
if response.status_code != 200: | |
raise Exception(response.status_code, response.text) | |
if __name__ == '__main__': | |
message = "Status check - success" | |
send_notification(URL, message) |
Hello Amal:
I came across your github and want to know if you happen to be worked on accessing ADLS Gen2 container\folder in Jupyter Notebook.
I am wanting to loop files from ADLS Gen2 container\folder for parsing & processing.
Any help on this is greatly appreciated.
Hi, it is easy. We just need to use the SDK to connect to ADLS and list the blobs.
Refer to this post.
https://amalgjose.com/2021/04/22/python-program-connect-to-azure-adls-gen2-using-service-principle/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello Amal:
I came across your github and want to know if you happen to be worked on accessing ADLS Gen2 container\folder in Jupyter Notebook.
I am wanting to loop files from ADLS Gen2 container\folder for parsing & processing.
Any help on this is greatly appreciated.