以下の内容はhttps://shuzo-kino.hateblo.jp/entry/2017/08/28/233900より取得しました。


PythonスクリプトからIFTTTのWebhookに投稿する

今回はPythonをつかって、IFTTTのWebhook*1

しくみを知りたい方はこちら
shuzo-kino.hateblo.jp
ブラウザからポチポチやりたい方はこちら
shuzo-kino.hateblo.jp

実際のところ

貴方のキーはYOURKEY、アプリ名はYOURAPPという想定でいきます。
requestsライブラリを導入して、こんな感じで。

import requests
data = {"value1": "abc", "value2": "def", "value3": "ghi"}
headers = {'Content-Type': "application/json"}
url = 'https://maker.ifttt.com/trigger/YOURAPP/with/key/YOURKEY'
response = requests.post(url, json=data, headers=headers)
print response.status_code

実行するとこんなふうにステータスコードを返します。

$ python sample.py 
200

*1:Makerチャンネルから改名




以上の内容はhttps://shuzo-kino.hateblo.jp/entry/2017/08/28/233900より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14