Skip to content

Instantly share code, notes, and snippets.

@skasero
skasero / logger_suppressor.py
Created July 1, 2025 23:30
Surpress log messages for `logging` package.
import logging
from typing import Set
# The global set of suppressed strings is used to avoid logging
_suppressed_strings: Set[str] = set()
class SuppressLogMessagesFilter(logging.Filter):
"""Filter that suppresses log records containing any of the target substrings."""
@skasero
skasero / st_route.py
Last active July 15, 2025 18:01 — forked from schaumb/st_route.py
Streamlit - Support custom HTTP requests
###########
## Original taken from https://gist.github.com/schaumb/d557dabf0beced7dfaa1be7acc09b1e4
## Modified and improved for better reliability
###########
import gc
import weakref
import logging
from typing import Optional, Callable, Union, Dict, Set
from collections import defaultdict