I tried to notify LINE of train delay information using LINE Notify. The source code is here.
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())
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)
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.
-Try using LINE Notify for the time being
Recommended Posts