using Messaging api
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
from selenium/standalone-chrome
|
FROM selenium/standalone-chrome:4.17.0
|
||||||
USER root
|
USER root
|
||||||
RUN useradd -ms /bin/bash netflix
|
RUN useradd -ms /bin/bash netflix
|
||||||
RUN apt update && apt install software-properties-common -y
|
RUN apt update && apt install software-properties-common -y
|
||||||
|
|||||||
@@ -1,16 +1,25 @@
|
|||||||
import requests
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
class LineNotifier:
|
class LineNotifier:
|
||||||
def __init__(self) -> None:
|
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 = {
|
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):
|
def notify(self, msg: str):
|
||||||
data = {
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user