MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _local_proxy_no_proxy_warning

Function _local_proxy_no_proxy_warning

uncommon_route/cli.py:660–687  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

658 return host in {"localhost", "127.0.0.1", "0.0.0.0", "::1"}
659
660 def _local_proxy_no_proxy_warning() -> str | None:
661 local_targets = [
662 os.environ.get("ANTHROPIC_BASE_URL", ""),
663 os.environ.get("OPENAI_BASE_URL", ""),
664 ]
665 if upstream:
666 local_targets.append(upstream)
667 if not any(target and _upstream_is_local(target) for target in local_targets):
668 return None
669
670 proxy_values = [
671 os.environ.get("http_proxy", ""),
672 os.environ.get("HTTP_PROXY", ""),
673 os.environ.get("https_proxy", ""),
674 os.environ.get("HTTPS_PROXY", ""),
675 ]
676 if not any(proxy_values):
677 return None
678
679 no_proxy = os.environ.get("NO_PROXY") or os.environ.get("no_proxy") or ""
680 tokens = {item.strip().lower() for item in no_proxy.split(",") if item.strip()}
681 required = {"localhost", "127.0.0.1", "::1"}
682 missing = sorted(required - tokens)
683 if not missing:
684 return None
685
686 missing_text = ", ".join(missing)
687 return f"proxy env is set; add NO_PROXY for local proxy access ({missing_text})"
688
689 api_key = connection.api_key
690 providers = load_providers()

Callers 1

_cmd_doctorFunction · 0.85

Calls 3

_upstream_is_localFunction · 0.85
getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected