Skip to content

Instantly share code, notes, and snippets.

@o8r
Last active February 5, 2018 01:58
Show Gist options
  • Select an option

  • Save o8r/fcc8dd4e7a276d8038f727bedf87c284 to your computer and use it in GitHub Desktop.

Select an option

Save o8r/fcc8dd4e7a276d8038f727bedf87c284 to your computer and use it in GitHub Desktop.
Line notify sinpet
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