0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Raspberry PiからLineに出力する

Posted at

# Raspberry PiからLineにメッセージを出力する。
Line Nptifyから
image.png

マイページを選択する。
image.png
アクセストークンをもらう。
image.png

image.png
発行をクリック
image.png
トークンを取得したならば

LineNotify.py
'''
Line Notify Test Program
'''
def LinePrint(msg):
    import requests
    token='{取得したトークン}'
    headers = {'Authorization': 'Bearer %s'%token, }        
    files = {'message': (None, msg),}
    r = requests.post('https://notify-api.line.me/api/notify', headers=headers, files=files)
    print(r,r.text)
LinePrint("\nhello world")

実行すると
image.png
Lineにメッセージを飛ばすことができる。

image.png

0
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?