mirror of
https://github.com/janLo/punkow
synced 2026-06-19 15:38:00 +00:00
Allow to hide personal information from log
This commit is contained in:
+12
-5
@@ -28,10 +28,11 @@ class BookingData(typing.NamedTuple):
|
|||||||
|
|
||||||
|
|
||||||
class BookingService(object):
|
class BookingService(object):
|
||||||
def __init__(self, start_url, debug=True):
|
def __init__(self, start_url, debug=True, hide_sensitive_data=False):
|
||||||
self.session = None
|
self.session = None
|
||||||
self.start_url = start_url
|
self.start_url = start_url
|
||||||
self.debug = debug
|
self.debug = debug
|
||||||
|
self.sensitive = hide_sensitive_data
|
||||||
|
|
||||||
self._init_session()
|
self._init_session()
|
||||||
|
|
||||||
@@ -52,6 +53,8 @@ class BookingService(object):
|
|||||||
self.session.headers.update({'Referrer': old_referrer})
|
self.session.headers.update({'Referrer': old_referrer})
|
||||||
|
|
||||||
def _print_details(self, zms, depth):
|
def _print_details(self, zms, depth):
|
||||||
|
if self.sensitive:
|
||||||
|
depth = min(depth, 3)
|
||||||
meta = {}
|
meta = {}
|
||||||
groups = zms.find_all("div", "collapsible-toggle")
|
groups = zms.find_all("div", "collapsible-toggle")
|
||||||
for group in groups[:depth]:
|
for group in groups[:depth]:
|
||||||
@@ -167,7 +170,8 @@ class BookingService(object):
|
|||||||
|
|
||||||
formdata["process"] = process.attrs["value"]
|
formdata["process"] = process.attrs["value"]
|
||||||
|
|
||||||
logger.info("Book with: %s", formdata)
|
if not self.sensitive:
|
||||||
|
logger.info("Book with: %s", formdata)
|
||||||
|
|
||||||
if self.debug:
|
if self.debug:
|
||||||
logger.warning("Not really booked as we're in debug mode!")
|
logger.warning("Not really booked as we're in debug mode!")
|
||||||
@@ -191,9 +195,12 @@ class BookingService(object):
|
|||||||
|
|
||||||
result = {key: register_html.find("span", {"class": f"summary_{key}"}).text.strip()
|
result = {key: register_html.find("span", {"class": f"summary_{key}"}).text.strip()
|
||||||
for key in ("name", "mail", "authKey", "processId")}
|
for key in ("name", "mail", "authKey", "processId")}
|
||||||
logger.info(" Registratred for: %s (%s)", result["name"], result["mail"])
|
if self.sensitive:
|
||||||
logger.info(" To change or cancel use %s with the number %s and the code %s", BASE_URL + MANAGE_URL,
|
logger.info(" Registration with number %s", result["processId"])
|
||||||
result["processId"], result["authKey"])
|
else:
|
||||||
|
logger.info(" Registratred for: %s (%s)", result["name"], result["mail"])
|
||||||
|
logger.info(" To change or cancel use %s with the number %s and the code %s", BASE_URL + MANAGE_URL,
|
||||||
|
result["processId"], result["authKey"])
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user