add travel code notify

This commit is contained in:
2024-03-31 18:15:17 +08:00
parent 78215fca70
commit bfcbd72a10
4 changed files with 54 additions and 13 deletions

16
line_notifier.py Normal file
View File

@@ -0,0 +1,16 @@
import requests
import os
class LineNotifier:
def __init__(self) -> None:
self.url = 'https://notify-api.line.me/api/notify'
self.headers = {
'Authorization': 'Bearer ' + os.environ['LINE_TOKEN']
}
def notify(self, msg: str):
data = {
'message': msg,
}
requests.post(self.url, headers=self.headers, data=data)