Ejemplo n.º 1
0
def new_laowai(sender, instance, **kwargs):
    apikey = settings.PROWL_API_KEY
    p = Prowl(apikey)
    try:
        p.add(
            'laowailai.com',
            'New Laowai',
            'A new user just registered',
        )
    except Exception,msg:
        print msg
Ejemplo n.º 2
0
# documentation and/or other materials provided with the distribution.
#
# * Neither the name of the University of California, Berkeley nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

"""
Example notification using prowl.
"""
from prowlpy import Prowl, ProwlError, ProwlAuthError

apikey = '1234567890123456789012345678901234567890' #Dummy API-key)
p = Prowl(apikey)
try:
    p.post('TestApp','Server Down',"The Web Box isn't responding to a ping")
    print 'Success'
except (ProwlAuthError, ProwlError), e:
    print str(e)

Ejemplo n.º 3
0
@simple_decorator
def must_be_owner(view):
    def inner(request, *args, **kwargs):
        if not request.user or request.user.is_anonymous(
        ) or request.user.username != args[0]:
            return HttpResponseForbidden('Not allowed')
        return view(request, *args, **kwargs)

    return inner


try:
    from prowlpy import Prowl
    if settings.PROWL_API_KEY:
        prowl_api = Prowl(settings.PROWL_API_KEY)
    else:
        prowl_api = None
except ImportError:
    import warnings
    warnings.warn("prowlpy no installed")
    prowl_api = None


def prowlpy_wrapper(event,
                    description="",
                    application="KungfuPeople",
                    priority=None):
    if not prowl_api:
        return