File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
mapswipe_workers/mapswipe_workers/utils Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 11"""Initialize slack client with values provided by the config file"""
22
33import json
4+
45import slack
56
6- from mapswipe_workers .definitions import CONFIG_PATH
7+ from mapswipe_workers .definitions import CONFIG_PATH , logger
78
89
910def send_slack_message (message_type : str , project_name : str , project_id : str = None ):
1011
1112 with open (CONFIG_PATH ) as config_file :
1213 config = json .load (config_file )
14+ try :
1315 slack_channel = config ["slack" ]["channel" ]
14- slack_client = slack .WebClient (token = config ["slack" ]["token" ])
16+ except KeyError :
17+ logger .info (
18+ "No configuration for Slack was found. "
19+ + "No '{0}' Slack message was sent." .format (message_type )
20+ )
21+ return None
22+ slack_client = slack .WebClient (token = config ["slack" ]["token" ])
1523
1624 if message_type == "success" :
1725 message = (
You can’t perform that action at this time.
0 commit comments