mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-04-05 14:35:17 +00:00
edits for codacy (#310)
This commit is contained in:
parent
9d552e5d24
commit
acbef6591c
8 changed files with 46 additions and 46 deletions
|
|
@ -21,23 +21,23 @@ from includes import globalVars # Global variables
|
|||
from includes.helper import configHandler
|
||||
|
||||
def isSignal(poc_id):
|
||||
"""
|
||||
@type poc_id: string
|
||||
@param poc_id: POCSAG Ric
|
||||
"""
|
||||
@type poc_id: string
|
||||
@param poc_id: POCSAG Ric
|
||||
|
||||
@requires: Configuration has to be set in the config.ini
|
||||
@requires: Configuration has to be set in the config.ini
|
||||
|
||||
@return: True if the Ric is Signal, other False
|
||||
@exception: none
|
||||
"""
|
||||
# If RIC is Signal return True, else False
|
||||
if globalVars.config.get("POC", "netIdent_ric"):
|
||||
if poc_id in globalVars.config.get("POC", "netIdent_ric"):
|
||||
logging.info("RIC %s is net ident", poc_id)
|
||||
return True
|
||||
else:
|
||||
logging.info("RIC %s is no net ident", poc_id)
|
||||
return False
|
||||
@return: True if the Ric is Signal, other False
|
||||
@exception: none
|
||||
"""
|
||||
# If RIC is Signal return True, else False
|
||||
if globalVars.config.get("POC", "netIdent_ric"):
|
||||
if poc_id in globalVars.config.get("POC", "netIdent_ric"):
|
||||
logging.info("RIC %s is net ident", poc_id)
|
||||
return True
|
||||
else:
|
||||
logging.info("RIC %s is no net ident", poc_id)
|
||||
return False
|
||||
|
||||
|
||||
##
|
||||
|
|
@ -87,7 +87,7 @@ def run(typ,freq,data):
|
|||
if configHandler.checkConfig("MySQL"): #read and debug the config
|
||||
|
||||
try:
|
||||
#
|
||||
#
|
||||
# Connect to MySQL
|
||||
#
|
||||
logging.debug("connect to MySQL")
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ def run(typ,freq,data):
|
|||
"""
|
||||
try:
|
||||
if configHandler.checkConfig("Sms77"): #read and debug the config
|
||||
|
||||
|
||||
# create an empty message an fill it with the required information
|
||||
message = "Alarm"
|
||||
if typ == "FMS":
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ def run(typ,freq,data):
|
|||
# Replace special characters in data Strings for URL
|
||||
#
|
||||
for key in data:
|
||||
if isinstance(data[key], basestring):
|
||||
data[key] = urllib.quote(data[key])
|
||||
if isinstance(data[key], basestring):
|
||||
data[key] = urllib.quote(data[key])
|
||||
#
|
||||
# Get URLs
|
||||
#
|
||||
|
|
|
|||
|
|
@ -268,23 +268,23 @@ def run(typ,freq,data):
|
|||
# nothing found
|
||||
pass
|
||||
# 3. lets look for ric prefixes in pocAPIKeyList
|
||||
for prefixLength in reversed(range(6)):
|
||||
ricPrefix = data['ric'][:prefixLength]
|
||||
#fill the ric with stars
|
||||
ricPrefix = ricPrefix.ljust(8,'*')
|
||||
try:
|
||||
xID = ricPrefix
|
||||
# data structure: pocAPIKeyList[xID][i] = (xAPIKey, xPriority, xEventPrefix)
|
||||
for i in range(len(pocAPIKeyList[xID])):
|
||||
xEvent = event
|
||||
(xAPIKey, xPriority, xEventPrefix) = pocAPIKeyList[xID][i]
|
||||
if len(xEventPrefix) > 0:
|
||||
xEvent = xEventPrefix + ": " + xEvent
|
||||
response = nma.pushWithAPIKey(xAPIKey, application, xEvent, msg, priority=xPriority)
|
||||
checkResponse(response, xAPIKey)
|
||||
except KeyError:
|
||||
# nothing found
|
||||
pass
|
||||
for prefixLength in reversed(range(6)):
|
||||
ricPrefix = data['ric'][:prefixLength]
|
||||
#fill the ric with stars
|
||||
ricPrefix = ricPrefix.ljust(8,'*')
|
||||
try:
|
||||
xID = ricPrefix
|
||||
# data structure: pocAPIKeyList[xID][i] = (xAPIKey, xPriority, xEventPrefix)
|
||||
for i in range(len(pocAPIKeyList[xID])):
|
||||
xEvent = event
|
||||
(xAPIKey, xPriority, xEventPrefix) = pocAPIKeyList[xID][i]
|
||||
if len(xEventPrefix) > 0:
|
||||
xEvent = xEventPrefix + ": " + xEvent
|
||||
response = nma.pushWithAPIKey(xAPIKey, application, xEvent, msg, priority=xPriority)
|
||||
checkResponse(response, xAPIKey)
|
||||
except KeyError:
|
||||
# nothing found
|
||||
pass
|
||||
|
||||
# end if "POC" in typ
|
||||
# end if usecsv == True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue