Last active
February 5, 2018 01:58
-
-
Save o8r/fcc8dd4e7a276d8038f727bedf87c284 to your computer and use it in GitHub Desktop.
Line notify sinpet
This file contains hidden or 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
| def line_notify(token, msg): | |
| """ Post a notification to LINE. | |
| :param str token: access token for LINE Notify | |
| :param str msg: notifier message | |
| """ | |
| import requests | |
| api = 'https://notify-api.line.me/api/notify' | |
| payload = {'message': msg} | |
| headers = {'Authorization': 'Bearer '+token} | |
| line_notify = requests.post(api, data=payload, headers=headers) | |
| # Usage: | |
| token = 'ABCDEF12...' | |
| line_notify(token, 'hello world!') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment