From b98faa06716b77d4c5dcf62e8ab02f278ad75eaf Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Sat, 15 Oct 2016 00:39:44 -0700 Subject: [PATCH] Update Slack agent --- plexpy/notifiers.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/plexpy/notifiers.py b/plexpy/notifiers.py index 92332843..a4301d46 100644 --- a/plexpy/notifiers.py +++ b/plexpy/notifiers.py @@ -2323,11 +2323,11 @@ class SLACK(Notifier): text = body.encode("utf-8") data = {'text': text} - if self.config['channel'] != '': + if self.config['channel']: data['channel'] = self.config['channel'] - if self.config['username'] != '': + if self.config['username']: data['username'] = self.config['username'] - if self.config['icon_emoji'] != '': + if self.config['icon_emoji']: if urlparse(self.config['icon_emoji']).scheme == '': data['icon_emoji'] = self.config['icon_emoji'] else: @@ -2364,12 +2364,12 @@ class SLACK(Notifier): data['attachments'] = [attachment] - slackhost = urlparse(self.config['hook']).hostname - slackpath = urlparse(self.config['hook']).path + host = urlparse(self.config['hook']).hostname + path = urlparse(self.config['hook']).path - http_handler = HTTPSConnection(slackhost) + http_handler = HTTPSConnection(host) http_handler.request("POST", - slackpath, + path, headers={'Content-type': "application/json"}, body=json.dumps(data)) @@ -2396,18 +2396,18 @@ class SLACK(Notifier): {'label': 'Slack Channel', 'value': self.config['channel'], 'name': 'slack_channel', - 'description': 'Your Slack channel name (begin with \'#\'). Leave blank for webhook integration default.', + 'description': 'The Slack channel name (begins with \'#\') which will be used. Leave blank for webhook integration default.', 'input_type': 'text' }, {'label': 'Slack Username', 'value': self.config['username'], 'name': 'slack_username', - 'description': 'The Slack username which will be shown. Leave blank for webhook integration default.', + 'description': 'The Slack username which will be used. Leave blank for webhook integration default.', 'input_type': 'text' }, {'label': 'Slack Icon', 'value': self.config['icon_emoji'], - 'description': 'The icon you wish to show, use Slack emoji or image url. Leave blank for webhook integration default.', + 'description': 'The Slack emoji or image url for the icon which will be used. Leave blank for webhook integration default.', 'name': 'slack_icon_emoji', 'input_type': 'text' },