move to python 3
This commit is contained in:
+6
-6
@@ -1,13 +1,13 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
import httplib, urllib
|
||||
import http.client, urllib.request, urllib.parse, urllib.error
|
||||
import getopt
|
||||
|
||||
def pushover(msg, title=""):
|
||||
conn = httplib.HTTPSConnection("api.pushover.net:443")
|
||||
conn = http.client.HTTPSConnection("api.pushover.net:443")
|
||||
conn.request("POST", "/1/messages.json",
|
||||
urllib.urlencode({
|
||||
urllib.parse.urlencode({
|
||||
"token": "aNY2xeYydxzabzihTjb3P2LMHhqhr2",
|
||||
"user": "uDhH33UjQQDYtNzJb1ThRiWb9ingGK",
|
||||
"message": msg,
|
||||
@@ -29,7 +29,7 @@ title="Nagios"
|
||||
optslist, args = [], []
|
||||
try:
|
||||
optslist, args = getopt.getopt(sys.argv[1:], 'ht:v')
|
||||
except getopt.error, cause:
|
||||
except getopt.error as cause:
|
||||
helpflag=True
|
||||
|
||||
lastyear=0
|
||||
@@ -44,6 +44,6 @@ v=" ".join(args)
|
||||
rc=pushover(v, title)
|
||||
if verbose:
|
||||
if rc:
|
||||
print "delivered"
|
||||
print("delivered")
|
||||
else:
|
||||
print "NOT delivered"
|
||||
print("NOT delivered")
|
||||
|
||||
Reference in New Issue
Block a user