MCPcopy Create free account
hub / github.com/Louisym/MiniCC / BadRuntime

Class BadRuntime

tutorials/18_design_patterns_for_agents.py:214–223  ·  view source on GitHub ↗

糟糕的设计: API 客户端在内部写死

Source from the content-addressed store, hash-verified

212 print(" ──────────────")
213
214 class BadRuntime:
215 """糟糕的设计: API 客户端在内部写死"""
216 def __init__(self):
217 # 问题: 测试时怎么办? 没网络怎么办? 想换 API 怎么办?
218 import urllib.request # noqa: F401 — 演示"写死"
219 self.api_url = "https://api.anthropic.com/v1/messages"
220
221 def run(self, user_input: str):
222 # 这里直接调 API——无法测试、无法替换
223 pass
224
225 print(" class BadRuntime:")
226 print(" def __init__(self):")

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected