Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tadaken3
Last active May 18, 2017 08:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tadaken3/aa382f2e52170a0bad591edde9ce30c8 to your computer and use it in GitHub Desktop.
Save tadaken3/aa382f2e52170a0bad591edde9ce30c8 to your computer and use it in GitHub Desktop.
PythonからLINE NotifyでLINEにメッセージを送る ref: http://qiita.com/tadaken3/items/0998c18df11d4a1c7427
#coding:UTF-8
import requests
def main():
url = "https://notify-api.line.me/api/notify"
token = #ここにアクセストークンを入力します。
headers = {"Authorization" : "Bearer "+ token}
message = 'ここにメッセージを入れます'
payload = {"message" : message}
files = {"imageFile": open("test.jpg", "rb")} #バイナリで画像ファイルを開きます。対応している形式はPNG/JPEGです。
r = requests.post(url ,headers = headers ,params=payload, files=files)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment