re-format with black

This commit is contained in:
2021-05-03 17:26:42 -04:00
parent 62ef10620f
commit 3252340eb8
2 changed files with 55 additions and 41 deletions
+10 -3
View File
@@ -3,14 +3,21 @@
import sys
import http.client, urllib.request, urllib.parse, urllib.error
def pushover(msg):
conn = http.client.HTTPSConnection("api.pushover.net:443")
conn.request("POST", "/1/messages.json",
urllib.parse.urlencode({
conn.request(
"POST",
"/1/messages.json",
urllib.parse.urlencode(
{
"token": "ac7NLX2rPjXFareeDgLpXNoDf4iFmf",
"user": "uDhH33UjQQDYtNzJb1ThRiWb9ingGK",
"message": msg,
}), { "Content-type": "application/x-www-form-urlencoded" })
}
),
{"Content-type": "application/x-www-form-urlencoded"},
)
r1 = conn.getresponse()
# print r1.status, r1.reason
return r1.status == 200
+13 -6
View File
@@ -4,15 +4,22 @@ import sys
import http.client, urllib.request, urllib.parse, urllib.error
import getopt
def pushover(msg, title=""):
conn = http.client.HTTPSConnection("api.pushover.net:443")
conn.request("POST", "/1/messages.json",
urllib.parse.urlencode({
conn.request(
"POST",
"/1/messages.json",
urllib.parse.urlencode(
{
"token": "aNY2xeYydxzabzihTjb3P2LMHhqhr2",
"user": "uDhH33UjQQDYtNzJb1ThRiWb9ingGK",
"message": msg,
"title": title,
}), { "Content-type": "application/x-www-form-urlencoded" })
}
),
{"Content-type": "application/x-www-form-urlencoded"},
)
r1 = conn.getresponse()
# print r1.status, r1.reason
return r1.status == 200
@@ -28,15 +35,15 @@ title="Nagios"
optslist, args = [], []
try:
optslist, args = getopt.getopt(sys.argv[1:], 'ht:v')
optslist, args = getopt.getopt(sys.argv[1:], "ht:v")
except getopt.error as cause:
helpflag = True
lastyear = 0
for o, a in optslist:
if o == '-v':
if o == "-v":
verbose = True
elif o == '-t':
elif o == "-t":
title = a