I thought I'd share this simple connector. This Library allows you to post comments to a channel on Slack.com. You will need to have an incoming webhook created for this (
https://api.slack.com/). I use it to post test start and end and some other useful information, sothat it is obvious to the team what is happening at any point in time.
"""
Library for integrating into Slack.com
2014 Oliver Erlewein
"""
import requests
import json
def Slack_Post(webhook, message, icon=None):
"""Posts a comment to Slack.com
"""
headers={'Content-Type':'application/json'}
if icon==None:
data={'text': message}
else:
data={'text': message, 'icon_emoji': icon }
data_json=json.dumps(data)
response =
requests.post( webhook, data=data_json, headers=headers)
return response.status_code