mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2025-12-06 07:42:03 +01:00
PEP8 changes to pushover
This commit is contained in:
parent
f92ce0d5f8
commit
cf1b5b3fc4
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -9,3 +9,5 @@ log/
|
|||
\.pydevproject
|
||||
|
||||
\.settings/
|
||||
|
||||
\.idea/
|
||||
|
|
|
|||
|
|
@ -10,14 +10,15 @@ Pushover-Plugin to send FMS-, ZVEI- and POCSAG - messages to Pushover Clients
|
|||
"""
|
||||
|
||||
import logging # Global logger
|
||||
import httplib #for the HTTP request
|
||||
import httplib # for the HTTP request
|
||||
import urllib
|
||||
from includes import globalVars # Global variables
|
||||
|
||||
#from includes.helper import timeHandler
|
||||
# from includes.helper import timeHandler
|
||||
from includes.helper import configHandler
|
||||
from includes.helper import wildcardHandler
|
||||
|
||||
|
||||
##
|
||||
#
|
||||
# onLoad (init) function of plugin
|
||||
|
|
@ -41,7 +42,7 @@ def onLoad():
|
|||
# Main function of Pushover-plugin
|
||||
# will be called by the alarmHandler
|
||||
#
|
||||
def run(typ,freq,data):
|
||||
def run(typ, freq, data):
|
||||
"""
|
||||
This function is the implementation of the Pushover-Plugin.
|
||||
It will send the data to Pushover API
|
||||
|
|
@ -58,7 +59,7 @@ def run(typ,freq,data):
|
|||
@return: nothing
|
||||
"""
|
||||
try:
|
||||
if configHandler.checkConfig("Pushover"): #read and debug the config
|
||||
if configHandler.checkConfig("Pushover"): # read and debug the config
|
||||
|
||||
if typ == "FMS":
|
||||
#
|
||||
|
|
@ -104,8 +105,8 @@ def run(typ,freq,data):
|
|||
|
||||
try:
|
||||
# replace the wildcards
|
||||
message = wildcardHandler.replaceWildcards(message,data)
|
||||
title = wildcardHandler.replaceWildcards(title,data)
|
||||
message = wildcardHandler.replaceWildcards(message, data)
|
||||
title = wildcardHandler.replaceWildcards(title, data)
|
||||
|
||||
# start the connection
|
||||
conn = httplib.HTTPSConnection("api.pushover.net:443")
|
||||
|
|
@ -119,7 +120,7 @@ def run(typ,freq,data):
|
|||
"priority": priority,
|
||||
"retry": globalVars.config.get("Pushover", "retry"),
|
||||
"expire": globalVars.config.get("Pushover", "expire")
|
||||
}),{"Content-type": "application/x-www-form-urlencoded"})
|
||||
}), {"Content-type": "application/x-www-form-urlencoded"})
|
||||
|
||||
except:
|
||||
logging.error("cannot send Pushover request")
|
||||
|
|
@ -131,11 +132,11 @@ def run(typ,freq,data):
|
|||
# check Pushover-Response
|
||||
#
|
||||
response = conn.getresponse()
|
||||
if str(response.status) == "200": #Check Pushover Response and print a Log or Error
|
||||
logging.debug("Pushover response: %s - %s" , str(response.status), str(response.reason))
|
||||
if str(response.status) == "200": # Check Pushover Response and print a Log or Error
|
||||
logging.debug("Pushover response: %s - %s", str(response.status), str(response.reason))
|
||||
else:
|
||||
logging.warning("Pushover response: %s - %s" , str(response.status), str(response.reason))
|
||||
except: #otherwise
|
||||
logging.warning("Pushover response: %s - %s", str(response.status), str(response.reason))
|
||||
except: # otherwise
|
||||
logging.error("cannot get Pushover response")
|
||||
logging.debug("cannot get Pushover response", exc_info=True)
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in a new issue