Parse Slack hostname

* Allow Mattermost notifications using Slack config
This commit is contained in:
JonnyWong16 2016-07-13 20:25:13 -07:00
parent 50e29efdfe
commit c3b0aef1ef

View file

@ -2010,11 +2010,12 @@ class SLACK(object):
data['attachments'] = [attachment] data['attachments'] = [attachment]
url = urlparse(self.slack_hook).path slackhost = urlparse(self.slack_hook).hostname
slackpath = urlparse(self.slack_hook).path
http_handler = HTTPSConnection("hooks.slack.com") http_handler = HTTPSConnection(slackhost)
http_handler.request("POST", http_handler.request("POST",
url, slackpath,
headers={'Content-type': "application/x-www-form-urlencoded"}, headers={'Content-type': "application/x-www-form-urlencoded"},
body=json.dumps(data)) body=json.dumps(data))
@ -2798,7 +2799,7 @@ class HIPCHAT(object):
http_handler = HTTPSConnection(hiphost) http_handler = HTTPSConnection(hiphost)
http_handler.request("POST", http_handler.request("POST",
"%s" % (hipfullq), hipfullq,
headers={'Content-type': "application/json"}, headers={'Content-type': "application/json"},
body=json.dumps(data)) body=json.dumps(data))
response = http_handler.getresponse() response = http_handler.getresponse()