When my Dragon Detector spots a new dragon I want it to notify the operator that something has happened. When looking for ways to do this, I discovered the IF THIS THEN THAT "Maker channel" this allows you to trigger IFTTT flows by calling a URL of the following form
https://maker.ifttt.com/trigger/{event}/with/key/{channel key}
You can also pass in parameters so that you can customise the flow. I added the IF client app to my mobile and configured a simple "recipe" to link the maker event to my notification.
To call this from the Dragonboard I used Pycurl which was installed earlier.
from StringIO import StringIO import pycurl def get_key(): with open('IFTTTKey.conf', 'r') as f: key = f.readline() f.close() return key def get_notifyURL(numDragons): return "https://maker.ifttt.com/trigger/DragonDetected/with/key/" + get_key() + "?value1=" + str(numDragons) def call_api(url): r = StringIO() c = pycurl.Curl() c.setopt(c.URL, url) c.setopt(c.CONNECTTIMEOUT, 10) c.setopt(c.TIMEOUT, 60) c.setopt(c.WRITEFUNCTION, r.write) c.perform() c.close() return r.getvalue() print call_api(get_notifyURL(2))