INNER CODE UNIT · Python

strip_fragment

witchan/ios-mcp · scripts/submit_bigboss_update.py:58

def strip_fragment(url: str) -> str:
    parts = urlsplit(url)
    return urlunsplit((parts.scheme, parts.netloc, parts.path, parts.query, ""))


def fetch_form(url: str, timeout: float) -> tuple[str, dict[str, str]]:
    request = Request(url, headers={"User-Agent": "ios-mcp-bigboss-update/1.1"})
    with urlopen(request, timeout=timeout) as response:
        html = response.read().decode("utf-8", "replace")

    parser = CFormsParser(FORM_ID)
    parser.feed(html)
    if not parser.form_seen:
        raise RuntimeError(f"BigBoss update form {FORM_ID} was not found")
    if parser.method != "post":
        raise RuntimeError(f"Unexpected BigBoss form method: {parser.method}")

    action = strip_fragment(urljoin(url, parser.action or url))

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…