Created
October 26, 2015 02:43
-
-
Save TheSkorm/ca0382f3df083cc3480c to your computer and use it in GitHub Desktop.
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
| #https://www.python.org/ftp/python/3.3.0/python-3.3.0.msi | |
| #http://pycurl.sourceforge.net/download/pycurl-7.19.5.1.win32-py3.3.exe | |
| import pycurl | |
| from io import BytesIO | |
| import json | |
| buffer = BytesIO() | |
| c = pycurl.Curl() | |
| c.setopt(c.URL, 'https://hooks.slack.com/services/XXXXXXXX') | |
| post_data = {"text": "This is a line of text in a channel.\nAnd this is another line of text."} | |
| postfields = json.dumps(post_data) | |
| c.setopt(pycurl.HTTPHEADER, ['Accept: application/json']) | |
| c.setopt(pycurl.POST, 1) | |
| c.setopt(c.POSTFIELDS, postfields) | |
| c.setopt(c.WRITEDATA, buffer) | |
| c.perform() | |
| c.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment