17 lines
393 B
Python
17 lines
393 B
Python
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)
|