[PYTHON] Try using LINE Notify for the time being

Try using LINE Notify for the time being

LINE Notify made it easy to implement LINE notifications, so I made a program that runs on python.

procedure

  1. Log in to Line Developer https://notify-bot.line.me/ja/

  2. Go to My Page from the upper right of the screen and issue a token

  3. Invite your LINE Notify account to the selected group

  4. Rewrite the access token and execute the program

python line_notify.py hello

that's all

program

line_notify.py


#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Use LINE Notify from Python
"""

import urllib
import urllib2
import os,sys

url = "https://notify-api.line.me/api/notify"
message = sys.argv[1]
params = {"message":message}
params = urllib.urlencode(params)

req = urllib2.Request(url)
#Header setting
req.add_header("Authorization","Bearer "+os.environ["LINE_ACCESS_TOKEN"])
#parameter settings
req.add_data(params)


res = urllib2.urlopen(req)
r = res.read()
print(r)

Easier to try with curl

curl -X POST -H'Authorization: Bearer <access token>' -F' message = <message>' https://notify-api.line.me/api/notify


reference

LINE Notify Official

https://notify-bot.line.me/ja/

Official documentation

https://notify-bot.line.me/static/pdf/line-notify-api.pdf

Recommended Posts

Try using LINE Notify for the time being
For the time being, try using the docomo chat dialogue API
Try using FireBase Cloud Firestore in Python for the time being
Molecular dynamics simulation to try for the time being
[Introduction to Reinforcement Learning] Reinforcement learning to try moving for the time being
Python Master RTA for the time being
Let's try Linux for the first time
I tried using scrapy for the first time
[Python] [Machine learning] Beginners without any knowledge try machine learning for the time being
For the time being, import them into jupyter
Make a histogram for the time being (matplotlib)
Use logger with Python for the time being
Run yolov4 "for the time being" on windows
virtualenv For the time being, this is all!
Try posting to Qiita for the first time
Try adding an external module to pepper. For the time being, in requests.
Flow memo to move LOCUST for the time being
Run with CentOS7 + Apache2.4 + Python3.6 for the time being
I will install Arch Linux for the time being.
Next to Excel, for the time being, jupyter notebook
Kaggle for the first time (kaggle ①)
Try using the Twitter API
Try LINE Notify in Python
Try using the Twitter API
Kaguru for the first time
Try using the PeeringDB 2.0 API
I will try to summarize the links that seem to be useful for the time being
I want to move selenium for the time being [for mac]
I tried running PIFuHD on Windows for the time being
Try a similar search for Image Search using the Python SDK [Search]
I want to create a Dockerfile for the time being.
Try the Python LINE Pay SDK
[For self-learning] Go2 for the first time
See python for the first time
Try using the Python Cmd module
Start Django for the first time
Java programmer tried to touch Go language (for the time being)
Understanding the python class Struggle (1) Let's move it for the time being
Challenge image classification by TensorFlow2 + Keras 1-Move for the time being-
Let's touch Google's Vision API from Python for the time being
For the time being, I want to convert files with ffmpeg !!
Try using the Wunderlist API in Python
I tried logistic regression analysis for the first time using Titanic data
Challenge image classification with TensorFlow2 + Keras CNN 1 ~ Move for the time being ~
Try using the $ 6 discount LiDAR (Camsense X1)
Try using the HL band in order
Try using the camera with Python's OpenCV
Try cluster analysis using the K-means method
MongoDB for the first time in Python
Try using a Linux server as a backup destination for Time Machine (Ver. 2020)
A useful note when using Python for the first time in a while
For the time being using FastAPI, I want to display how to use API like that on swagger
I bought Sipeed Lichee Zero so I set it up for the time being
I checked the library for using the Gracenote API
How to use MkDocs for the first time
vprof --I tried using the profiler for Python
Try using the BitFlyer Ligntning API in Python
Python: Try using the UI on Pythonista 3 on iPad
Try using the Chinese morphological analysis engine jieba
I tried python programming for the first time.
Try using the Python web framework Tornado Part 1