__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
"""
A simulation of Rich console logging.
"""
import time
from rich.console import Console
from rich.style import Style
from rich.theme import Theme
from rich.highlighter import RegexHighlighter
class RequestHighlighter(RegexHighlighter):
base_style = "req."
highlights = [
r"^(?P<protocol>\w+) (?P<method>\w+) (?P<path>\S+) (?P<result>\w+) (?P<stats>\[.+\])$",
r"\/(?P<filename>\w+\..{3,4})",
]
theme = Theme(
{
"req.protocol": Style.parse("dim bold green"),
"req.method": Style.parse("bold cyan"),
"req.path": Style.parse("magenta"),
"req.filename": Style.parse("bright_magenta"),
"req.result": Style.parse("yellow"),
"req.stats": Style.parse("dim"),
}
)
console = Console(theme=theme)
console.log("Server starting...")
console.log("Serving on http://127.0.0.1:8000")
time.sleep(1)
request_highlighter = RequestHighlighter()
console.log(
request_highlighter("HTTP GET /foo/bar/baz/egg.html 200 [0.57, 127.0.0.1:59076]"),
)
console.log(
request_highlighter(
"HTTP GET /foo/bar/baz/background.jpg 200 [0.57, 127.0.0.1:59076]"
),
)
time.sleep(1)
def test_locals():
foo = (1, 2, 3)
movies = ["Deadpool", "Rise of the Skywalker"]
console = Console()
console.log(
"[b]JSON[/b] RPC [i]batch[/i]",
[
{"jsonrpc": "2.0", "method": "sum", "params": [1, 2, 4], "id": "1"},
{"jsonrpc": "2.0", "method": "notify_hello", "params": [7]},
{"jsonrpc": "2.0", "method": "subtract", "params": [42, 23], "id": "2"},
{"foo": "boo"},
{
"jsonrpc": "2.0",
"method": "foo.get",
"params": {"name": "myself", "enable": False, "grommits": None},
"id": "5",
},
{"jsonrpc": "2.0", "method": "get_data", "id": "9"},
],
log_locals=True,
)
test_locals()
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| README.md | File | 264 B | 0644 |
|
| attrs.py | File | 1.01 KB | 0644 |
|
| bars.py | File | 417 B | 0644 |
|
| columns.py | File | 748 B | 0644 |
|
| cp_progress.py | File | 571 B | 0644 |
|
| downloader.py | File | 2.21 KB | 0644 |
|
| dynamic_progress.py | File | 3.93 KB | 0644 |
|
| exception.py | File | 919 B | 0644 |
|
| export.py | File | 1.65 KB | 0644 |
|
| file_progress.py | File | 423 B | 0644 |
|
| fullscreen.py | File | 5.36 KB | 0644 |
|
| group.py | File | 206 B | 0644 |
|
| group2.py | File | 224 B | 0644 |
|
| highlighter.py | File | 525 B | 0644 |
|
| jobs.py | File | 957 B | 0644 |
|
| justify.py | File | 349 B | 0644 |
|
| justify2.py | File | 426 B | 0644 |
|
| layout.py | File | 1.09 KB | 0644 |
|
| link.py | File | 192 B | 0644 |
|
| listdir.py | File | 1011 B | 0644 |
|
| live_progress.py | File | 1.34 KB | 0644 |
|
| log.py | File | 1.9 KB | 0644 |
|
| overflow.py | File | 370 B | 0644 |
|
| padding.py | File | 132 B | 0644 |
|
| print_calendar.py | File | 1.87 KB | 0644 |
|
| rainbow.py | File | 441 B | 0644 |
|
| recursive_error.py | File | 324 B | 0644 |
|
| repr.py | File | 589 B | 0644 |
|
| save_table_svg.py | File | 846 B | 0644 |
|
| screen.py | File | 357 B | 0644 |
|
| spinners.py | File | 533 B | 0644 |
|
| status.py | File | 307 B | 0644 |
|
| suppress.py | File | 489 B | 0644 |
|
| table.py | File | 693 B | 0644 |
|
| table_movie.py | File | 4.46 KB | 0644 |
|
| top_lite_simulator.py | File | 2.11 KB | 0644 |
|
| tree.py | File | 1.71 KB | 0644 |
|