Changes request by review

This commit is contained in:
Lars Gremme 2022-01-23 12:25:30 +01:00
parent c6df7a6b7b
commit 0e386e79c9
3 changed files with 11 additions and 11 deletions

View file

@ -2,7 +2,7 @@
--- ---
## Beschreibung ## Beschreibung
Mit diesem Plugin ist es moeglich, Http-Anfragen für Alarmierungen an Divera 24/7 zu senden. Mit diesem Plugin ist es möglich, HTTPS-Anfragen für Alarmierungen an Divera 24/7 zu senden.
Wildcards in den Urls werden automatisch ersetzt. Wildcards in den Urls werden automatisch ersetzt.
## Unterstütze Alarmtypen ## Unterstütze Alarmtypen

View file

@ -113,7 +113,7 @@ tput cup 13 15
echo "[ 2/9] [##-------]" echo "[ 2/9] [##-------]"
tput cup 15 5 tput cup 15 5
echo "-> download GIT and other stuff.........." echo "-> download GIT and other stuff.........."
apt-get -y install git cmake build-essential libusb-1.0 qt5-qmake libpulse-dev libx11-dev sox >> ${boswatch_install_path}/setup_log.txt 2>&1 apt-get -y install git cmake build-essential libusb-1.0 qt5-qmake qt5-default libpulse-dev libx11-dev sox >> ${boswatch_install_path}/setup_log.txt 2>&1
exitcodefunction $? download stuff exitcodefunction $? download stuff
tput cup 13 15 tput cup 13 15

View file

@ -50,7 +50,7 @@ class BoswatchPlugin(PluginBase):
"priority": fms_data.get("priority", default="false"), "priority": fms_data.get("priority", default="false"),
}) })
apipath = "/api/fms" apipath = "/api/fms"
self.makeRequests(apipath, apicall) self._makeRequests(apipath, apicall)
def pocsag(self, bwPacket): def pocsag(self, bwPacket):
"""!Called on POCSAG alarm """!Called on POCSAG alarm
@ -66,7 +66,7 @@ class BoswatchPlugin(PluginBase):
"priority": poc_data.get("priority", default="false"), "priority": poc_data.get("priority", default="false"),
}) })
apipath = "/api/alarm" apipath = "/api/alarm"
self.makeRequests(apipath, apicall) self._makeRequests(apipath, apicall)
def zvei(self, bwPacket): def zvei(self, bwPacket):
"""!Called on ZVEI alarm """!Called on ZVEI alarm
@ -82,7 +82,7 @@ class BoswatchPlugin(PluginBase):
"priority": zvei_data.get("priority", default="false"), "priority": zvei_data.get("priority", default="false"),
}) })
apipath = "/api/alarm" apipath = "/api/alarm"
self.makeRequests(apipath, apicall) self._makeRequests(apipath, apicall)
def msg(self, bwPacket): def msg(self, bwPacket):
"""!Called on MSG packet """!Called on MSG packet
@ -98,9 +98,9 @@ class BoswatchPlugin(PluginBase):
"priority": msg_data.get("priority", default="false"), "priority": msg_data.get("priority", default="false"),
}) })
apipath = "/api/alarm" apipath = "/api/alarm"
self.makeRequests(apipath, apicall) self._makeRequests(apipath, apicall)
def makeRequests(self, apipath, apicall): def _makeRequests(self, apipath, apicall):
"""Parses wildcard urls and handles asynchronus requests """Parses wildcard urls and handles asynchronus requests
@param urls: array of urls""" @param urls: array of urls"""
@ -109,10 +109,10 @@ class BoswatchPlugin(PluginBase):
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
future = asyncio.ensure_future(self.asyncRequests(request)) future = asyncio.ensure_future(self._asyncRequests(request))
loop.run_until_complete(future) loop.run_until_complete(future)
async def asyncRequests(self, url): async def _asyncRequests(self, url):
"""Handles asynchronus requests """Handles asynchronus requests
@param urls: array of urls to send requests to""" @param urls: array of urls to send requests to"""
@ -120,13 +120,13 @@ class BoswatchPlugin(PluginBase):
async with ClientSession() as session: async with ClientSession() as session:
logging.debug("Generated URL: [{}]".format(url)) logging.debug("Generated URL: [{}]".format(url))
task = asyncio.ensure_future(self.fetch(url, session)) task = asyncio.ensure_future(self._fetch(url, session))
tasks.append(task) tasks.append(task)
responses = asyncio.gather(*tasks) responses = asyncio.gather(*tasks)
await responses await responses
async def fetch(self, url, session): async def _fetch(self, url, session):
"""Fetches requests """Fetches requests
@param url: url @param url: url