fix: shield_update PATCH 메서드 수정 + client.py patch() 추가 + Bot Detection/Access Lists 도구
All checks were successful
CI / build (push) Successful in 42s
All checks were successful
CI / build (push) Successful in 42s
This commit is contained in:
@@ -34,6 +34,15 @@ class BunnyClient:
|
||||
)
|
||||
return self._handle(resp)
|
||||
|
||||
async def patch(self, path: str, json: dict | None = None) -> dict | list | str:
|
||||
async with httpx.AsyncClient(timeout=REQUEST_TIMEOUT) as c:
|
||||
resp = await c.patch(
|
||||
f"{self._base}{path}",
|
||||
headers=self._headers,
|
||||
json=json,
|
||||
)
|
||||
return self._handle(resp)
|
||||
|
||||
async def put(self, path: str, json: dict | None = None) -> dict | list | str:
|
||||
async with httpx.AsyncClient(timeout=REQUEST_TIMEOUT) as c:
|
||||
resp = await c.put(
|
||||
|
||||
@@ -90,7 +90,8 @@ def register_shield_tools(mcp):
|
||||
except json.JSONDecodeError as e:
|
||||
return f"Error: Invalid JSON: {e}"
|
||||
try:
|
||||
data = await client.put(f"/shield/shield-zone/{shield_zone_id}", json=parsed)
|
||||
body = {"shieldZoneId": shield_zone_id, "shieldZone": parsed}
|
||||
data = await client.patch("/shield/shield-zone", json=body)
|
||||
return json.dumps(data, indent=2) if isinstance(data, dict) else f"Shield zone {shield_zone_id} updated"
|
||||
except Exception as e:
|
||||
logger.error("bunny_shield_update failed: %s", e)
|
||||
|
||||
Reference in New Issue
Block a user