INNER CODE UNIT · Python

_is_loopback

MakazhanAlpamys/Soup · src/soup_cli/ui/app.py:362

def _is_loopback(host: str) -> bool:
    """Return True if host is a loopback address or localhost."""
    if host.lower() == "localhost":
        return True
    try:
        return ipaddress.ip_address(host.strip("[]")).is_loopback
    except ValueError:
        return False


def create_app(host: str = "127.0.0.1", port: int = 7860):
    """Create the Soup Web UI FastAPI application."""
    if not _is_loopback(host):
        token = get_auth_token()
        valid = False
        if token:
            try:
                from soup_cli.utils.qr_url import validate_token

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…