[python] Line Notify

回覆文章
Lexaul
文章: 231
註冊時間: 2019-10-18, 14:28

[python] Line Notify

文章 Lexaul » 2022-02-07, 09:37

https://ithelp.ithome.com.tw/articles/10234115

代碼: 選擇全部

#基本功能測試
import requests

def lineNotifyMessage(token, msg):

    headers = {
        "Authorization": "Bearer " + token, 
        "Content-Type" : "application/x-www-form-urlencoded"
    }

    payload = {'message': msg }
    r = requests.post("https://notify-api.line.me/api/notify", headers = headers, params = payload)
    return r.status_code


if __name__ == "__main__":
  token = '你的token'
  message = '訊息測試'
  lineNotifyMessage(token, message)
[email protected]
github.com/Lexaul

回覆文章