INNER CODE UNIT · Python

_text

shuvonsec/claude-bug-bounty · demo/app.py:122

def _text(body: str, status: int = 200) -> tuple[int, bytes, dict]:
    return status, body.encode("utf-8"), {"Content-Type": "text/plain; charset=utf-8"}


def _json(obj, status: int = 200) -> tuple[int, bytes, dict]:
    return status, json.dumps(obj, indent=2).encode("utf-8"), {"Content-Type": "application/json"}


class DemoHandler(BaseHTTPRequestHandler):
    server_version = "shuvonsec/1.0"

    # Quiet the default per-request access log so the recording stays clean.
    def log_message(self, fmt, *args):  # noqa: A003
        sys.stderr.write("%s - %s\n" % (self.address_string(), fmt % args))

    def _send(self, status: int, body: bytes, headers: dict) -> None:
        self.send_response(status)
        for k, v in headers.items():

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…