mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-07-06 20:03:02 +02:00
- Added module docstrings to 19 Python files - Added class docstrings to 5 classes (ScreenLocker, PokerModifierApp, etc.) - Added method docstrings to 22 methods - Added function docstrings to 25 functions - Added __init__ docstrings to 5 classes - Removed D100-D107 from ruff ignore list (docstrings now enforced) - Removed deprecated ANN101, ANN102, UP038 rules from ignore list - Fixed UP038: use union types in isinstance() calls - All ruff checks now pass with full docstring enforcement
15 lines
472 B
Python
15 lines
472 B
Python
"""Mitmproxy addon to simulate connection failures."""
|
|
|
|
from mitmproxy import http
|
|
|
|
|
|
def request(flow: http.HTTPFlow) -> None:
|
|
"""Intercept requests and simulate failures for specific hosts."""
|
|
# Only intercept traffic to example.com
|
|
if "example.com" in flow.request.host:
|
|
flow.response = http.Response.make(
|
|
502, # Bad Gateway status code
|
|
b"Simulated connection failure",
|
|
{"Content-Type": "text/plain"},
|
|
)
|