Created
October 20, 2019 11:56
-
-
Save e96031413/552d97beefed14c2a0d87928bd079268 to your computer and use it in GitHub Desktop.
使用LINE Notify TOKEN建立自己的Line BOT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
# 修改為你要傳送的訊息內容 | |
message = 'Hello World' | |
# 修改為你的權杖內容 | |
token = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' | |
lineNotifyMessage(token, message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment