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
|
||||
# python -u
|
||||
ENTRYPOINT [ "python", "-u", "./langfingaz/main.py" ]
|
||||
ENTRYPOINT [ "python", "./langfingaz/main.py" ]
|
||||
CMD [ "log-verbose" ]
|
||||
|
@ -3,11 +3,12 @@ import requests
|
||||
from xml.etree import ElementTree
|
||||
|
||||
import langfingaz.util.fileUtil as fileUtil
|
||||
import langfingaz.util.util as util
|
||||
|
||||
|
||||
def requestMeetingData() -> str:
|
||||
requestUrl = getRequestUrl()
|
||||
print(">> starting request for " + requestUrl)
|
||||
util.debug("starting request for " + requestUrl)
|
||||
response = requests.get(requestUrl)
|
||||
if not response.ok:
|
||||
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)
|
||||
bbbStatus = parseMeetings.BbbStatus(meetings)
|
||||
bbbStatusStr = str(bbbStatus)
|
||||
print(util.indentMultilineStr(bbbStatusStr), flush=True)
|
||||
print(util.indentMultilineStr(bbbStatusStr))
|
||||
|
||||
sleepFiveMin(verbose=True)
|
||||
|
||||
@ -38,7 +38,7 @@ def v2(folder: Path = saveData.getDefaultFolder()):
|
||||
def v1(folder: Path = saveData.getDefaultFolder()):
|
||||
while True:
|
||||
saveData.requestAndSaveMeetingData(folder)
|
||||
print('.', end='', flush=True)
|
||||
print('.')
|
||||
sleepFiveMin()
|
||||
|
||||
|
||||
|
@ -3,11 +3,12 @@ from sys import argv
|
||||
|
||||
from langfingaz import plotMeetings
|
||||
from langfingaz import logMeetingData
|
||||
from langfingaz.util import util
|
||||
|
||||
|
||||
def main():
|
||||
print("=== bbb-status ===")
|
||||
print(">> given args: " + str(argv))
|
||||
util.debug(str(argv))
|
||||
print()
|
||||
|
||||
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'):
|
||||
indented = indentWith + s.replace('\n', '\n' + indentWith)
|
||||
if s.endswith('\n'):
|
||||
indented = indented[:len(indented)-len(indentWith)]
|
||||
indented = indented[:len(indented) - len(indentWith)]
|
||||
return indented
|
||||
|
||||
|
||||
def asString(o: object):
|
||||
attrs = vars(o) # attributes and their values
|
||||
return '\n'.join("%s: %s" % item for item in attrs.items())
|
||||
|
Loading…
Reference in New Issue
Block a user