Files
netflix-clicker/line_notifier.py
2025-04-19 22:02:51 +08:00

26 lines
647 B
Python

import os
import requests
class LineNotifier:
def __init__(self) -> None:
self.url = 'https://api.line.me/v2/bot/message/push'
self.headers = {
'Authorization': 'Bearer ' + os.environ['LINE_TOKEN'],
'Content-Type': 'application/json',
}
self.group_id = os.environ['LINE_GROUP_ID']
def notify(self, msg: str):
data = {
"to": self.group_id,
'messages': [
{
'type': 'text',
'text': msg,
}
]
}
requests.post(self.url, headers=self.headers, json=data)