ifttt_test0.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import requests as req
  2. from urllib import parse
  3. import datetime
  4. import os
  5. x = 2
  6. def ifttt():
  7. evt = 'notify_me' # 事件名稱
  8. key = 'c3xo5EvpBX64fPEqxphcR4jBTzDh1r2joTDsB_BslOA'
  9. val1 = parse.quote(str(x)) # value1參數值
  10. val2 = parse.quote('open') # value1參數值
  11. val3 = parse.quote('forget') # value1參數值
  12. url = (f'https://maker.ifttt.com/trigger/{evt}' +
  13. f'/with/key/{key}?value1={val1}&value2={val2},&value3={val3}')
  14. r = req.get(url) # 執行IFTTT平台的webhooks
  15. r.text # 取得IFTTT的回應
  16. ifttt()
  17. os.system(ifconfig)
  18. '''
  19. evt = 'notify_me' # 事件名稱
  20. key = 'c3xo5EvpBX64fPEqxphcR4jBTzDh1r2joTDsB_BslOA'
  21. val1 = parse.quote('執行第') # value1參數值
  22. val2 = parse.quote(str(x)) # value2參數值
  23. val3 = parse.quote('次') # value3參數值
  24. url = (f'https://maker.ifttt.com/trigger/{evt}' +
  25. f'/with/key/{key}?value1={val1}&value2={val2}&value3={val3}')
  26. r = req.get(url) # 執行IFTTT平台的webhooks
  27. r.text # 取得IFTTT的回應
  28. x = x+1
  29. '''