mirror of
https://github.com/chaitin/SafeLine.git
synced 2026-02-08 17:53:33 +08:00
add mcp get_attack_event tool
This commit is contained in:
@@ -15,7 +15,21 @@ def check_slce_response(response: httpx.Response) -> str:
|
||||
|
||||
return "success"
|
||||
|
||||
async def post_slce_api(path: str,req_body: dict) -> str:
|
||||
async def get_slce_api(path: str) -> str:
|
||||
if not path.startswith("/"):
|
||||
path = f"/{path}"
|
||||
|
||||
try:
|
||||
async with AsyncClient(verify=False) as client:
|
||||
response = await client.get(f"{GLOBAL_CONFIG.SAFELINE_ADDRESS}{path}", json=req_body, headers={
|
||||
"X-SLCE-API-TOKEN": f"{GLOBAL_CONFIG.SAFELINE_API_TOKEN}"
|
||||
})
|
||||
return check_slce_response(response)
|
||||
except Exception as e:
|
||||
return str(e)
|
||||
|
||||
|
||||
async def post_slce_api(path: str, req_body: dict) -> str:
|
||||
if not path.startswith("/"):
|
||||
path = f"/{path}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user