import requests as req
from urllib import parse

import datetime
import os

x = 2
def ifttt():
    evt = 'notify_me'   # 事件名稱
    key = 'c3xo5EvpBX64fPEqxphcR4jBTzDh1r2joTDsB_BslOA'
    val1 = parse.quote(str(x))  # value1參數值
    val2 = parse.quote('open')  # value1參數值
    val3 = parse.quote('forget')  # value1參數值

    url = (f'https://maker.ifttt.com/trigger/{evt}' +
           f'/with/key/{key}?value1={val1}&value2={val2},&value3={val3}')

    r = req.get(url)  # 執行IFTTT平台的webhooks
    r.text   # 取得IFTTT的回應

ifttt()
os.system(ifconfig)

'''
    evt = 'notify_me'  # 事件名稱
    key = 'c3xo5EvpBX64fPEqxphcR4jBTzDh1r2joTDsB_BslOA'
    val1 = parse.quote('執行第')  # value1參數值
    val2 = parse.quote(str(x))  # value2參數值
    val3 = parse.quote('次')  # value3參數值

    url = (f'https://maker.ifttt.com/trigger/{evt}' +
           f'/with/key/{key}?value1={val1}&value2={val2}&value3={val3}')

    r = req.get(url)  # 執行IFTTT平台的webhooks
    r.text  # 取得IFTTT的回應
    x = x+1
    '''

