Search code examples
python-2.7posthttprequestiotifttt

Assigning values to IFTTT Maker "ingredient" variables from a Python 'request'


According to documentation available on the Web, it should be possible to invoke a IFTTT Maker recipe with

import requests
payload = "{ 'value1' : 'P', 'value2' : 'Q', 'value3' : 'R'}"
requests.post("https://maker.ifttt.com/trigger/TRIGGER/with/key/KEY", data=payload)

This successfully involves the recipe. But all of the ingredient values ('value1', etc.) are blank in the response.

The corresponding curl successfully sets the values:

curl -X POST -H "Content-Type: application/json" -d '{"value1":"P","value2":"Q","value3":"R"}' https://maker.ifttt.com/trigger/TRIGGER/with/key/KEY

How do I supply a payload to the request that correctly assigns these values?


Solution

  • The code sample in the linked article is wrong. The payload should be a dict (not a string description of a dict):

    payload = { 'value1' : 'P', 'value2' : 'Q', 'value3' : 'R'}