29 lines
566 B
Text
29 lines
566 B
Text
|
#!/usr/bin/env python
|
||
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
import sys
|
||
|
import os
|
||
|
from pushover import Pushover # https://github.com/Wyattjoh/pushover
|
||
|
|
||
|
|
||
|
class Config(object):
|
||
|
api_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||
|
user_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||
|
|
||
|
def main(message, title):
|
||
|
po = Pushover(Config.api_key)
|
||
|
po.user(Config.user_key)
|
||
|
|
||
|
msg = po.msg(message)
|
||
|
msg.set("title", title)
|
||
|
po.send(msg)
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
if len(sys.argv) < 2:
|
||
|
title = os.uname().nodename
|
||
|
else:
|
||
|
title = sys.argv[1]
|
||
|
message = sys.stdin.read()
|
||
|
|
||
|
main(message, title)
|
||
|
|