diff --git a/dockerfile b/dockerfile index 10a4ff7..3f59672 100644 --- a/dockerfile +++ b/dockerfile @@ -1,4 +1,4 @@ -from selenium/standalone-chrome +FROM selenium/standalone-chrome:4.17.0 USER root RUN useradd -ms /bin/bash netflix RUN apt update && apt install software-properties-common -y diff --git a/line_notifier.py b/line_notifier.py index 6547574..9a3ff13 100644 --- a/line_notifier.py +++ b/line_notifier.py @@ -1,16 +1,25 @@ -import requests import os +import requests + class LineNotifier: def __init__(self) -> None: - self.url = 'https://notify-api.line.me/api/notify' + self.url = 'https://api.line.me/v2/bot/message/push' self.headers = { - 'Authorization': 'Bearer ' + os.environ['LINE_TOKEN'] + 'Authorization': 'Bearer ' + os.environ['LINE_TOKEN'], + 'Content-Type': 'application/json', } + self.group_id = os.environ['LINE_GROUP_ID'] def notify(self, msg: str): data = { - 'message': msg, + "to": self.group_id, + 'messages': [ + { + 'type': 'text', + 'text': msg, + } + ] } - requests.post(self.url, headers=self.headers, data=data) + requests.post(self.url, headers=self.headers, json=data)