diff --git a/TODO b/TODO index 619d7fc..492639c 100644 --- a/TODO +++ b/TODO @@ -38,47 +38,3 @@ * Can we use cointracker to get external portfolio data? * Check prices across exchanges? https://marketplace.visualstudio.com/items?itemName=ms-python.isort - -## Document Logger: Response - -# https://stackoverflow.com/questions/16337511/log-all-requests-from-the-python-requests-module -logger = logging.getLogger("httplogger") -user.binance_client().session -session.hooks["response"].append(logRoundtrip) -def logRoundtrip(response, *args, **kwargs): - extra = {"req": response.request, "res": response} - logger.debug("HTTP roundtrip", extra=extra) - -## Document Logger: Raw Stuff - -def debug_requests_on(): - """Switches on logging of the requests module.""" - HTTPConnection.debuglevel = 2 - - logging.basicConfig() - logging.getLogger().setLevel(logging.DEBUG) - requests_log = logging.getLogger("requests.packages.urllib3") - requests_log.setLevel(logging.DEBUG) - requests_log.propagate = True - - -def debug_requests_off(): - """Switches off logging of the requests module, might be some side-effects""" - HTTPConnection.debuglevel = 0 - - root_logger = logging.getLogger() - root_logger.setLevel(logging.WARNING) - root_logger.handlers = [] - requests_log = logging.getLogger("requests.packages.urllib3") - requests_log.setLevel(logging.WARNING) - requests_log.propagate = False - - -@contextlib.contextmanager -def debug_requests(): - """Use with 'with'!""" - debug_requests_on() - yield - debug_requests_off() - -