LINE Notify 通知API

通知API

LINE Notify 認証APIで取得したトークンを使って、通知を行う。



notify


・通知する。( こっち => LINE )

import urllib3
・・・・
        headers = {
            'Authorization': f'Bearer {認証APIで取得したトークン}'
        }

        # post の fields はエンコードしてくれる
        fields = {
            'message': '送信するメッセージ',
        }

        # http リクエスト
        http = urllib3.PoolManager()
        http_response = http.request(
            'POST',
            'https://notify-api.line.me/api/notify',
            fields=fields,
            headers=headers
        )

        if 200 != http_response.status:
            # エラー
            ・・・・
        ・・・・


通知はこれでおしまい。