[PYTHON] I tried to notify the train delay information with LINE Notify

I tried to notify LINE of train delay information using LINE Notify. The source code is here.

Acquisition of train delay information

I used Railway delay information json. If you send a request, you can get a list of delayed routes in JSON.

import urllib2
import json

res = urllib2.urlopen("https://rti-giken.jp/fhc/api/train_tetsudo/delay.json")
datas = json.loads(res.read())

Notify LINE

Log in to LINE Notify and issue an access token. Perform POST.

import urllib
import urllib2

params = {"message":"Message you want to notify"}
params = urllib.urlencode(params)
    
req = urllib2.Request("https://notify-api.line.me/api/notify")
req.add_header("Authorization","Bearer " + "Issued token")
req.add_data(params)

res = urllib2.urlopen(req)

Summary

I was able to get the delay information and notify LINE in just a few lines. After that, you can run it regularly every morning to notify the delay information, If you put your boss in the same group and you are late, you can automatically send a late notification.

LINE Notify is so easy to use that you'll want to experiment with it.

reference

-Try using LINE Notify for the time being

Recommended Posts

I tried to notify the train delay information with LINE Notify
I tried to notify the honeypot report on LINE
I tried to save the data with discord
I tried to get the movie information of TMDb API with Python
I tried to control the network bandwidth and delay with the tc command
I tried to learn the sin function with chainer
I tried to touch the CSV file with Python
I tried to solve the soma cube with python
I tried to visualize the spacha information of VTuber
I tried to solve the problem with Python Vol.1
I tried to automatically send the literature of the new coronavirus to LINE with Python
I tried to find the entropy of the image with python
I tried to simulate how the infection spreads with Python
I tried to analyze the whole novel "Weathering with You" ☔️
I tried to get the location information of Odakyu Bus
I tried to find the average of the sequence with TensorFlow
I tried to put out the frequent word ranking of LINE talk with Python
I tried to visualize the characteristics of new coronavirus infected person information with wordcloud
Notify LINE of train operation information
I tried to divide the file into folders with Python
[Uncorrelated test] I tried to put out the boundary line with or without rejection
I tried to get various information from the codeforces API
I tried to move the ball
I tried to estimate the interval.
I tried to describe the traffic in real time with WebSocket
I want to know the weather with LINE bot feat.Heroku + Python
I tried to automate the watering of the planter with Raspberry Pi
I tried to process the image in "sketch style" with OpenCV
I tried to get started with Bitcoin Systre on the weekend
I tried to process the image in "pencil style" with OpenCV
I tried to expand the size of the logical volume with LVM
I tried to improve the efficiency of daily work with Python
PhytoMine-I tried to get the genetic information of plants with Python
I tried to implement Autoencoder with TensorFlow
I tried to summarize the umask command
I tried to visualize AutoEncoder with TensorFlow
I tried to recognize the wake word
I tried to get started with Hy
I tried to summarize the graphical modeling.
I tried to estimate the pi stochastically
I tried to touch the COTOHA API
I tried to implement CVAE with PyTorch
I tried playing with the image with Pillow
I tried to solve TSP with QAOA
[Python] I tried to visualize the night on the Galactic Railroad with WordCloud!
I tried to refer to the fun rock-paper-scissors poi for beginners with Python
[Yahoo! Weather Replacement Version] How to get weather information with LINE Notify + Python
I tried to express sadness and joy with the stable marriage problem.
765 I tried to identify the three professional families by CNN (with Chainer 2.0.0)
I tried to make "Sakurai-san" a LINE BOT with API Gateway + Lambda
I tried to get the authentication code of Qiita API with Python.
I tried to automatically extract the movements of PES players with software
I tried to learn the angle from sin and cos with chainer
I tried with the top 100 PyPI packages> I tried to graph the packages installed on Python
I tried to analyze the negativeness of Nono Morikubo. [Compare with Posipa]
I tried fMRI data analysis with python (Introduction to brain information decoding)
I tried to streamline the standard role of new employees with Python
I tried to visualize the text of the novel "Weathering with You" with WordCloud
I tried to visualize the model with the low-code machine learning library "PyCaret"
I tried to predict the behavior of the new coronavirus with the SEIR model.
I tried to train the RWA (Recurrent Weighted Average) model in Keras