#!/usr/local/bin/python # -*- coding: utf-8 -*- def lineNotify(message): payload = {'message':message} return _lineNotify(payload) def notifyPicture(url): payload = {'message':" ",'imageThumbnail':url,'imageFullsize':url} return _lineNotify(payload) def notifySticker(stickerID,stickerPackageID): payload = {'message':" ",'stickerPackageId':stickerPackageID,'stickerId':stickerID} return _lineNotify(payload) def _lineNotify(payload): import requests url = 'https://notify-api.line.me/api/notify' token = '9IBnp37LVHj0a6W5HLq2dF7sqIjGyEVn2DQtpQq7wYv' #EDIT headers = {'content-type':'application/x-www-form-urlencoded','Authorization':'Bearer '+token} return requests.post(url, headers=headers , data = payload) print lineNotify('ทดสอบภาษาไทย hello') print notifySticker(40,2) print notifyPicture("https://www.honey.co.th/wp-content/uploads/2017/03/cropped-logo_resize.png")