コード例 #1
0
    def get_pushover_client(self):
        key = self.pushover_key

        if key is None:
            key = 'DUMMYKEY' # to return a valid client
        
        return PushoverClient(api_token=app.config.get('PUSHOVER_KEY'), user_key=key)
コード例 #2
0
def test_no_config():
    try:
        ps = PushoverClient(configfile="file_does_not_exist")
    except PushoverException:
        cls, instance, traceback = sys.exc_info()
        assert (instance.message == "No valid configuration found")
    return
コード例 #3
0
def test_message_with_kwargs():
    """pushover.net updated their API to support a number of additional arguments
    see https://pushover.net/api
    """
    ps = PushoverClient()
    ps.send_message("Fancy Test Message",
                    title="fancy test",
                    url="https://pushover.net/api",
                    priority="1")
コード例 #4
0
    def setUp(self):
        self.APP_KEY = os.environ['PUSHOVER_APP_KEY']
        self.TEST_USER = os.environ['TEST_USER_KEY']
        if "PUSHOVER_MESSAGE" in os.environ:
            self.MESSAGE = os.environ["PUSHOVER_MESSAGE"]
        else:
            self.MESSAGE = "UNITESTING PUSHOVER CLIENT"

        assert (self.TEST_USER != "") and (self.APP_KEY != "")
        self.client = PushoverClient(self.APP_KEY)
コード例 #5
0
ファイル: test.py プロジェクト: vaginessa/pushover-1
def test_message_too_big():
    try:
        ps = PushoverClient()
        ps.send_message("""
Whereas recognition of the inherent dignity and of the equal and inalienable rights of all members of the human family is the foundation of freedom, justice and peace in the world,

Whereas disregard and contempt for human rights have resulted in barbarous acts which have outraged the conscience of mankind, and the advent of a world in which human beings shall enjoy freedom of speech and belief and freedom from fear and want has been proclaimed as the highest aspiration of the common people,

Whereas it is essential, if man is not to be compelled to have recourse, as a last resort, to rebellion against tyranny and oppression, that human rights should be protected by the rule of law,

Whereas it is essential to promote the development of friendly relations between nations,""")
    except PushoverMessageTooBig:
        cls, instance, traceback = sys.exc_info()
        assert(instance.message=="The supplied message is bigger than 512 characters.")
    return
コード例 #6
0
ファイル: co2.py プロジェクト: wickedchicken/co2
#!/usr/bin/env python2

import sys, fcntl, time, os

from Adafruit_IO import Client
from pushover import Client as PushoverClient

AIO_USER = os.getenv('AIO_USER')
AIO_KEY = os.getenv('AIO_USER')

PUSHOVER_CLIENT = os.getenv('PUSHOVER_CLIENT')
PUSHOVER_TOKEN = os.getenv('PUSHOVER_TOKEN')

aio = Client(AIO_USER, AIO_KEY)
pushover = PushoverClient(PUSHOVER_CLIENT, api_token=PUSHOVER_TOKEN)

def decrypt(key,  data):
    cstate = [0x48,  0x74,  0x65,  0x6D,  0x70,  0x39,  0x39,  0x65]
    shuffle = [2, 4, 0, 7, 1, 6, 5, 3]

    phase1 = [0] * 8
    for i, o in enumerate(shuffle):
        phase1[o] = data[i]

    phase2 = [0] * 8
    for i in range(8):
        phase2[i] = phase1[i] ^ key[i]

    phase3 = [0] * 8
    for i in range(8):
        phase3[i] = ( (phase2[i] >> 3) | (phase2[ (i-1+8)%8 ] << 5) ) & 0xff
コード例 #7
0
def test_send_message():
    ps = PushoverClient()
    ps.send_message("Test message from PushoverClient")