def notifyPushbullet(api="", msg=""): data = urllib.urlencode({"type": "note", "title": "pyLoad: TraktFetcher added Package", "body": "\n\n".join(msg)}) auth = base64.encodestring("%s:" % api).replace("\n", "") try: req = urllib2.Request("https://api.pushbullet.com/v2/pushes", data) req.add_header("Authorization", "Basic %s" % auth) response = urllib2.urlopen(req) except urllib2.HTTPError: print "Failed much" return False res = json.load(response) if res["sender_name"]: print "Pushbullet Success" else: print "Pushbullet Fail"
def notifyPushover(api='', msg=''): data = urllib.urlencode({ 'user': api, 'token': 'aBGPe78hyxBKfRawhuGbzttrEaQ9rW', 'title': 'pyLoad: TraktFetcher added Package', 'message': "\n".join(msg) }) try: req = urllib2.Request('https://api.pushover.net/1/messages.json', data) response = urllib2.urlopen(req) except urllib2.HTTPError: print 'Failed much' return False res = json.load(response) if res['status'] == 1: print 'Pushover Success' else: print 'Pushover Fail'
def notifyPushbullet(api='', msg=''): data = urllib.urlencode({ 'type': 'note', 'title': 'pyLoad: TraktFetcher added Package', 'body': "\n\n".join(msg) }) auth = base64.encodestring('%s:' % api).replace('\n', '') try: req = urllib2.Request('https://api.pushbullet.com/v2/pushes', data) req.add_header('Authorization', 'Basic %s' % auth) response = urllib2.urlopen(req) except urllib2.HTTPError: print 'Failed much' return False res = json.load(response) if res['sender_name']: print 'Pushbullet Success' else: print 'Pushbullet Fail'
def notifyPushover(api="", msg=""): data = urllib.urlencode( { "user": api, "token": "aBGPe78hyxBKfRawhuGbzttrEaQ9rW", "title": "pyLoad: TraktFetcher added Package", "message": "\n".join(msg), } ) try: req = urllib2.Request("https://api.pushover.net/1/messages.json", data) response = urllib2.urlopen(req) except urllib2.HTTPError: print "Failed much" return False res = json.load(response) if res["status"] == 1: print "Pushover Success" else: print "Pushover Fail"