using Messaging api

This commit is contained in:
2025-04-19 22:02:51 +08:00
parent e8583e0c29
commit f54430332e
2 changed files with 15 additions and 6 deletions

View File

@@ -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

View File

@@ -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)