-
-
Save ifitzpat/99689b7b64d6d560d94d to your computer and use it in GitHub Desktop.
boxcar-growl.py - Send Boxcar Notification with CLI (Python)
This file contains 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
#!/usr/bin/env python | |
import os | |
import sys | |
import subprocess | |
import shlex | |
def notify (token, mymessage, mytitle): | |
# Default config | |
DEFAULT_SOUND = 'clanging' | |
DEFAULT_IMAGE = 'http://i.imgur.com/Fea7vsF.png' | |
# Example: curl -d "user_credentials=ACCESS_TOKEN" -d "notification[title]=message title" -d "notification[long_message]=<b>Some text or HTML for the full layout page notification</b>" -d "notification[sound]=bird-1" -d "notification[source_name]=My own alert" -d "notification[icon_url]=http://new.boxcar.io/images/rss_icons/boxcar-64.png" https://new.boxcar.io/api/notifications | |
curlCmd = [] | |
curlCmd.append('curl') | |
curlCmd.append('-d "user_credentials=' + token + '"') | |
curlCmd.append('-d "notification[title]=' + mytitle + '"') | |
curlCmd.append('-d "notification[long_message]=' + mymessage + '"') | |
curlCmd.append('-d "notification[sound]=' + DEFAULT_SOUND + '"') | |
curlCmd.append('-d "notification[icon_url]=' + DEFAULT_IMAGE + '"') | |
curlCmd.append('https://new.boxcar.io/api/notifications') | |
subprocess.call(shlex.split(' '.join(curlCmd))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment