29 lines
No EOL
566 B
Python
29 lines
No EOL
566 B
Python
#!/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)
|
|
|