Created
November 15, 2016 21:31
-
-
Save WardsParadox/76ba3b26491da5ff6a294051b5e16d2c to your computer and use it in GitHub Desktop.
boxcarNotify.py
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/python | |
''' | |
Sends boxcar.io notifications, you need a token so sign up at boxcar.io! | |
''' | |
try: | |
import requests | |
except ImportError: | |
print 'Please install requests' | |
defaulticon = "https://github.com/munkireport/munkireport-php/raw/wip/assets/images/favicons/android-chrome-192x192.png" | |
def boxcarnotify(accesstoken, title, message, sound="success", | |
icon=defaulticon, source_name="Box Car Test"): | |
url = "https://new.boxcar.io/api/notifications" | |
data = {} | |
data["user_credentials"] = accesstoken | |
data["notification[title]"] = title | |
data["notification[long_message]"] = message | |
data["notification[sound]"] = sound | |
data["notification[icon_url]"] = icon | |
data["notification[source_name]"] = source_name | |
requests.post(url, data) | |
return data | |
def main(): | |
accesstoken = "Find Yours Via boxcar.io" | |
boxcarnotify(accesstoken, "Testing Notification", | |
"testing this in python") | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment