Skip to content

Commit

Permalink
scratch file
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Burch authored and Jacob Burch committed Jul 7, 2009
0 parents commit becee0f
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Prowlpy V0.2

Written by Jacob Burch, 7/6/2009

Python module for posting to the iPhone Push Notification service Prowl: http://prowl.weks.net/

from prowlpy import Prowl
p = Prowl(username='username',password='password')
p.post('application','event','description')
40 changes: 40 additions & 0 deletions prowlpy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
"""
Prowlpy V0.2
Written by Jacob Burch, 7/6/2009
Python module for posting to the iPhone Push Notification service Prowl: http://prowl.weks.net/
from prowlpy import Prowl
"""

import httplib2
import urllib
__author__ = 'jacobburch@gmail.com'
__version__ = 0.2

class Prowl(object):
def __init__(self,username,password):
self.username = username
self.password = password

def post(self,application=None,event=None,description=None):
h = httplib2.Http(".cache")
h.add_credentials(self.username,self.password)
headers = {'User-Agent': "ProwlScriptPy/%s" % str(VERSION)}

data = {}
application = urllib.quote(str(application))
event = urllib.quote(str(event))
desciption = urllib.quote(str(description))

resp,content = h.request("https://prowl.weks.net/api/add_notification.php?application=%s&event=%s&description=%s" /
% (application, event, description))

if(resp['status']=='200'):
print "Success!"
elif(resp['status']=='401'):
print "Auth Failed"
else:
print "Failed"

0 comments on commit becee0f

Please sign in to comment.