add travel code notify
This commit is contained in:
16
line_notifier.py
Normal file
16
line_notifier.py
Normal 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)
|
||||
Reference in New Issue
Block a user