Skip to content

Instantly share code, notes, and snippets.

@e96031413
Created October 20, 2019 11:56
Show Gist options
  • Save e96031413/552d97beefed14c2a0d87928bd079268 to your computer and use it in GitHub Desktop.
Save e96031413/552d97beefed14c2a0d87928bd079268 to your computer and use it in GitHub Desktop.
使用LINE Notify TOKEN建立自己的Line BOT
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