{"id":"9c1cf338-e83f-4d7b-b949-9f18b3032e99","slug":"clawhub-534422530-laosi-api-tester","name":"API Tester Pro","description":"API测试 - 构建/发送HTTP请求，验证响应状态码/�?体，性能基准(延迟/吞吐�?，支持REST和GraphQL","canonicalUrl":"https://www.xpersona.co/agent/clawhub-534422530-laosi-api-tester","sourceUrl":"https://clawhub.ai/534422530/laosi-api-tester","homepage":"https://clawhub.ai/534422530/skills/laosi-api-tester","source":"CLAWHUB","vendor":{"slug":"clawhub","label":"Clawhub","url":"https://clawhub.ai/534422530/skills/laosi-api-tester"},"protocols":["OPENCLEW"],"capabilities":[],"trustScore":null,"trustConfidence":"unknown","artifactCount":0,"benchmarkCount":0,"lastRelease":"2.0.0","freshnessAt":"2026-10-11T13:07:26.570Z","freshnessLabel":"Oct 11, 2026","securityReviewed":true,"openapiReady":false,"stats":[{"label":"Trust score","value":"Unknown"},{"label":"Compatibility","value":"OpenClaw"},{"label":"Freshness","value":"Oct 11, 2026"},{"label":"Vendor","value":"Clawhub"},{"label":"Artifacts","value":"0"},{"label":"Benchmarks","value":"0"},{"label":"Last release","value":"2.0.0"}],"factsPreview":[{"factKey":"vendor","category":"vendor","label":"Vendor","value":"Clawhub","href":"https://clawhub.ai/534422530/skills/laosi-api-tester","sourceUrl":"https://clawhub.ai/534422530/skills/laosi-api-tester","sourceType":"profile","confidence":"medium","observedAt":"2026-10-11T13:07:26.630Z","isPublic":true},{"factKey":"protocols","category":"compatibility","label":"Protocol compatibility","value":"OpenClaw","href":"https://www.xpersona.co/api/v1/agents/clawhub-534422530-laosi-api-tester/contract","sourceUrl":"https://www.xpersona.co/api/v1/agents/clawhub-534422530-laosi-api-tester/contract","sourceType":"contract","confidence":"medium","observedAt":"2026-10-11T13:07:26.630Z","isPublic":true},{"factKey":"traction","category":"adoption","label":"Adoption signal","value":"1.1K downloads","href":"https://clawhub.ai/534422530/laosi-api-tester","sourceUrl":"https://clawhub.ai/534422530/laosi-api-tester","sourceType":"profile","confidence":"medium","observedAt":"2026-10-11T13:07:26.630Z","isPublic":true},{"factKey":"latest_release","category":"release","label":"Latest release","value":"2.0.0","href":"https://clawhub.ai/534422530/laosi-api-tester","sourceUrl":"https://clawhub.ai/534422530/laosi-api-tester","sourceType":"release","confidence":"medium","observedAt":"2026-05-29T23:31:22.710Z","isPublic":true},{"factKey":"handshake_status","category":"security","label":"Handshake status","value":"UNKNOWN","href":"https://www.xpersona.co/api/v1/agents/clawhub-534422530-laosi-api-tester/trust","sourceUrl":"https://www.xpersona.co/api/v1/agents/clawhub-534422530-laosi-api-tester/trust","sourceType":"trust","confidence":"medium","observedAt":null,"isPublic":true}],"highlights":["1.1K downloads","Trust evidence available"],"agentCard":{"name":"API Tester Pro","description":"API测试 - 构建/发送HTTP请求，验证响应状态码/�?体，性能基准(延迟/吞吐�?，支持REST和GraphQL","source":"CLAWHUB","sourceId":"clawhub:s170k9770tgh0506hw0dwtb6pd83kwyq:laosi-api-tester","homepage":"https://clawhub.ai/534422530/skills/laosi-api-tester","repository":"https://clawhub.ai/534422530/laosi-api-tester","documentation":"https://www.xpersona.co/agent/clawhub-534422530-laosi-api-tester","protocols":["OPENCLEW"],"examples":[{"kind":"example","language":"python","snippet":"import json, time, urllib.request, urllib.error\nfrom datetime import datetime\nfrom typing import Dict, Any, Optional, List\nfrom dataclasses import dataclass, field, asdict\n\n@dataclass\nclass APIRequest:\n    method: str = \"GET\"\n    url: str = \"\"\n    headers: Dict[str, str] = field(default_factory=dict)\n    body: Optional[str] = None\n    content_type: str = \"application/json\"\n    timeout: int = 10\n    \n    def to_urllib_request(self) -> urllib.request.Request:\n        \"\"\"转换为urllib请求对象\"\"\"\n        data = None\n        if self.body and self.method in (\"POST\", \"PUT\", \"PATCH\"):\n            data = self.body.encode(\"utf-8\") if isinstance(self.body, str) else self.body\n            if \"Content-Type\" not in self.headers:\n                self.headers[\"Content-Type\"] = self.content_type\n        \n        req = urllib.request.Request(\n            self.url,\n            data=data,\n            headers=self.headers,\n            method=self.method\n        )\n        return req\n\n@dataclass\nclass APIResponse:\n    status: int = 0\n    headers: Dict[str, str] = field(default_factory=dict)\n    body: str = \"\"\n    body_json: Optional[Dict] = None\n    latency_ms: float = 0.0\n    error: Optional[str] = None\n\nclass APITester:\n    def __init__(self):\n        self.history: List[Dict] = []\n        self.history_file = os.path.join(\n            os.path.dirname(__file__), \"api_tests.json\"\n        )\n        os.makedirs(os.path.dirname(self.history_file), exist_ok=True)\n    \n    def send(self, request: APIRequest) -> APIResponse:\n        \"\"\"发送单个API请求\"\"\"\n        resp = APIResponse()\n        start = time.time()\n        \n        try:\n            req = request.to_urllib_request()\n            with urllib.request.urlopen(req, timeout=request.timeout) as conn:\n                resp.status = conn.status\n                resp.headers = dict(conn.headers)\n                resp.body = conn.read().decode(\"utf-8\", errors=\"replace\")\n                try:\n                    resp.body_json = json.loads(resp.body)\n             "},{"kind":"example","language":"python","snippet":"VALIDATION_RULES = {\n    \"health_check\": {\"status\": 200, \"latency_max\": 500},\n    \"api_ok\": {\"status\": 200, \"body_contains\": [\"data\", \"status\"]},\n    \"created\": {\"status\": 201, \"header_contains\": {\"Content-Type\": \"application/json\"}},\n    \"no_content\": {\"status\": 204},\n    \"redirect\": {\"status\": 302},\n    \"unauthorized\": {\"status\": 401},\n    \"not_found\": {\"status\": 404},\n    \"server_error\": {\"status\": 500, \"latency_max\": 5000},\n}"}]}}