mirror of
https://codeberg.org/langfingaz/bbb-status
synced 2024-11-21 20:23:17 +01:00
add debug method
This commit is contained in:
parent
97f2400c41
commit
81f1042bf8
@ -41,5 +41,5 @@ RUN chmod +x ./langfingaz/main.py
|
|||||||
|
|
||||||
# unbuffered output option otherwise script sleeps before any output appears
|
# unbuffered output option otherwise script sleeps before any output appears
|
||||||
# python -u
|
# python -u
|
||||||
ENTRYPOINT [ "python", "-u", "./langfingaz/main.py" ]
|
ENTRYPOINT [ "python", "./langfingaz/main.py" ]
|
||||||
CMD [ "log-verbose" ]
|
CMD [ "log-verbose" ]
|
||||||
|
@ -3,11 +3,12 @@ import requests
|
|||||||
from xml.etree import ElementTree
|
from xml.etree import ElementTree
|
||||||
|
|
||||||
import langfingaz.util.fileUtil as fileUtil
|
import langfingaz.util.fileUtil as fileUtil
|
||||||
|
import langfingaz.util.util as util
|
||||||
|
|
||||||
|
|
||||||
def requestMeetingData() -> str:
|
def requestMeetingData() -> str:
|
||||||
requestUrl = getRequestUrl()
|
requestUrl = getRequestUrl()
|
||||||
print(">> starting request for " + requestUrl)
|
util.debug("starting request for " + requestUrl)
|
||||||
response = requests.get(requestUrl)
|
response = requests.get(requestUrl)
|
||||||
if not response.ok:
|
if not response.ok:
|
||||||
raise ValueError("error during request, got status code {}".format(response.status_code))
|
raise ValueError("error during request, got status code {}".format(response.status_code))
|
||||||
|
@ -30,7 +30,7 @@ def v2(folder: Path = saveData.getDefaultFolder()):
|
|||||||
meetings = parseMeetings.parseMeetingsData(meetingsStr)
|
meetings = parseMeetings.parseMeetingsData(meetingsStr)
|
||||||
bbbStatus = parseMeetings.BbbStatus(meetings)
|
bbbStatus = parseMeetings.BbbStatus(meetings)
|
||||||
bbbStatusStr = str(bbbStatus)
|
bbbStatusStr = str(bbbStatus)
|
||||||
print(util.indentMultilineStr(bbbStatusStr), flush=True)
|
print(util.indentMultilineStr(bbbStatusStr))
|
||||||
|
|
||||||
sleepFiveMin(verbose=True)
|
sleepFiveMin(verbose=True)
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ def v2(folder: Path = saveData.getDefaultFolder()):
|
|||||||
def v1(folder: Path = saveData.getDefaultFolder()):
|
def v1(folder: Path = saveData.getDefaultFolder()):
|
||||||
while True:
|
while True:
|
||||||
saveData.requestAndSaveMeetingData(folder)
|
saveData.requestAndSaveMeetingData(folder)
|
||||||
print('.', end='', flush=True)
|
print('.')
|
||||||
sleepFiveMin()
|
sleepFiveMin()
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,11 +3,12 @@ from sys import argv
|
|||||||
|
|
||||||
from langfingaz import plotMeetings
|
from langfingaz import plotMeetings
|
||||||
from langfingaz import logMeetingData
|
from langfingaz import logMeetingData
|
||||||
|
from langfingaz.util import util
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
print("=== bbb-status ===")
|
print("=== bbb-status ===")
|
||||||
print(">> given args: " + str(argv))
|
util.debug(str(argv))
|
||||||
print()
|
print()
|
||||||
|
|
||||||
usageStr = 'Usage:\n' + argv[0] + ' [log|log-verbose|plot]\n' + \
|
usageStr = 'Usage:\n' + argv[0] + ' [log|log-verbose|plot]\n' + \
|
||||||
|
@ -1,9 +1,18 @@
|
|||||||
|
BBB_STATUS_DEBUG = True
|
||||||
|
|
||||||
|
|
||||||
|
def debug(message: str):
|
||||||
|
if BBB_STATUS_DEBUG:
|
||||||
|
print(">> " + message)
|
||||||
|
|
||||||
|
|
||||||
def indentMultilineStr(s: str, indentWith='\t'):
|
def indentMultilineStr(s: str, indentWith='\t'):
|
||||||
indented = indentWith + s.replace('\n', '\n' + indentWith)
|
indented = indentWith + s.replace('\n', '\n' + indentWith)
|
||||||
if s.endswith('\n'):
|
if s.endswith('\n'):
|
||||||
indented = indented[:len(indented)-len(indentWith)]
|
indented = indented[:len(indented) - len(indentWith)]
|
||||||
return indented
|
return indented
|
||||||
|
|
||||||
|
|
||||||
def asString(o: object):
|
def asString(o: object):
|
||||||
attrs = vars(o) # attributes and their values
|
attrs = vars(o) # attributes and their values
|
||||||
return '\n'.join("%s: %s" % item for item in attrs.items())
|
return '\n'.join("%s: %s" % item for item in attrs.items())
|
||||||
|
Loading…
Reference in New Issue
Block a user